<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Kubectl Reference Docs</title>
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.min.css" type="text/css">
<link rel="stylesheet" href="node_modules/highlight.js/styles/default.css" type="text/css">
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>
<body>
<div id="sidebar-wrapper" class="side-nav side-bar-nav"><ul><li class="nav-level-1 strong-nav"><a href="#-strong-getting-started-strong-" class="nav-item"><strong>GETTING STARTED</strong></a></li></ul><ul><li class="nav-level-1"><a href="#run" class="nav-item">run</a></li></ul><ul><li class="nav-level-1"><a href="#run-container" class="nav-item">run-container</a></li></ul><ul><li class="nav-level-1"><a href="#expose" class="nav-item">expose</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-app-management-strong-" class="nav-item"><strong>APP MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#annotate" class="nav-item">annotate</a></li></ul><ul><li class="nav-level-1"><a href="#autoscale" class="nav-item">autoscale</a></li></ul><ul><li class="nav-level-1"><a href="#convert" class="nav-item">convert</a></li></ul><ul><li class="nav-level-1"><a href="#create" class="nav-item">create</a></li><ul id="create-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-clusterrole-em-" class="nav-item"><em>clusterrole</em></a></li><li class="nav-level-2"><a href="#-em-clusterrolebinding-em-" class="nav-item"><em>clusterrolebinding</em></a></li><li class="nav-level-2"><a href="#-em-configmap-em-" class="nav-item"><em>configmap</em></a></li><li class="nav-level-2"><a href="#-em-deployment-em-" class="nav-item"><em>deployment</em></a></li><li class="nav-level-2"><a href="#-em-job-em-" class="nav-item"><em>job</em></a></li><li class="nav-level-2"><a href="#-em-namespace-em-" class="nav-item"><em>namespace</em></a></li><li class="nav-level-2"><a href="#-em-poddisruptionbudget-em-" class="nav-item"><em>poddisruptionbudget</em></a></li><li class="nav-level-2"><a href="#-em-priorityclass-em-" class="nav-item"><em>priorityclass</em></a></li><li class="nav-level-2"><a href="#-em-quota-em-" class="nav-item"><em>quota</em></a></li><li class="nav-level-2"><a href="#-em-role-em-" class="nav-item"><em>role</em></a></li><li class="nav-level-2"><a href="#-em-rolebinding-em-" class="nav-item"><em>rolebinding</em></a></li><li class="nav-level-2"><a href="#-em-secret-em-" class="nav-item"><em>secret</em></a></li><li class="nav-level-2"><a href="#-em-secret-docker-registry-em-" class="nav-item"><em>secret docker-registry</em></a></li><li class="nav-level-2"><a href="#-em-secret-generic-em-" class="nav-item"><em>secret generic</em></a></li><li class="nav-level-2"><a href="#-em-secret-tls-em-" class="nav-item"><em>secret tls</em></a></li><li class="nav-level-2"><a href="#-em-service-em-" class="nav-item"><em>service</em></a></li><li class="nav-level-2"><a href="#-em-service-clusterip-em-" class="nav-item"><em>service clusterip</em></a></li><li class="nav-level-2"><a href="#-em-service-externalname-em-" class="nav-item"><em>service externalname</em></a></li><li class="nav-level-2"><a href="#-em-service-loadbalancer-em-" class="nav-item"><em>service loadbalancer</em></a></li><li class="nav-level-2"><a href="#-em-service-nodeport-em-" class="nav-item"><em>service nodeport</em></a></li><li class="nav-level-2"><a href="#-em-serviceaccount-em-" class="nav-item"><em>serviceaccount</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#delete" class="nav-item">delete</a></li></ul><ul><li class="nav-level-1"><a href="#edit" class="nav-item">edit</a></li></ul><ul><li class="nav-level-1"><a href="#get" class="nav-item">get</a></li></ul><ul><li class="nav-level-1"><a href="#label" class="nav-item">label</a></li></ul><ul><li class="nav-level-1"><a href="#patch" class="nav-item">patch</a></li></ul><ul><li class="nav-level-1"><a href="#replace" class="nav-item">replace</a></li></ul><ul><li class="nav-level-1"><a href="#rolling-update" class="nav-item">rolling-update</a></li></ul><ul><li class="nav-level-1"><a href="#rollout" class="nav-item">rollout</a></li><ul id="rollout-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-history-em-" class="nav-item"><em>history</em></a></li><li class="nav-level-2"><a href="#-em-pause-em-" class="nav-item"><em>pause</em></a></li><li class="nav-level-2"><a href="#-em-resume-em-" class="nav-item"><em>resume</em></a></li><li class="nav-level-2"><a href="#-em-status-em-" class="nav-item"><em>status</em></a></li><li class="nav-level-2"><a href="#-em-undo-em-" class="nav-item"><em>undo</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#scale" class="nav-item">scale</a></li></ul><ul><li class="nav-level-1"><a href="#set" class="nav-item">set</a></li><ul id="set-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-env-em-" class="nav-item"><em>env</em></a></li><li class="nav-level-2"><a href="#-em-image-em-" class="nav-item"><em>image</em></a></li><li class="nav-level-2"><a href="#-em-resources-em-" class="nav-item"><em>resources</em></a></li><li class="nav-level-2"><a href="#-em-selector-em-" class="nav-item"><em>selector</em></a></li><li class="nav-level-2"><a href="#-em-serviceaccount-em--1" class="nav-item"><em>serviceaccount</em></a></li><li class="nav-level-2"><a href="#-em-subject-em-" class="nav-item"><em>subject</em></a></li></ul></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-declarative-app-management-strong-" class="nav-item"><strong>DECLARATIVE APP MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#apply" class="nav-item">apply</a></li><ul id="apply-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-edit-last-applied-em-" class="nav-item"><em>edit-last-applied</em></a></li><li class="nav-level-2"><a href="#-em-set-last-applied-em-" class="nav-item"><em>set-last-applied</em></a></li><li class="nav-level-2"><a href="#-em-view-last-applied-em-" class="nav-item"><em>view-last-applied</em></a></li></ul></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-working-with-apps-strong-" class="nav-item"><strong>WORKING WITH APPS</strong></a></li></ul><ul><li class="nav-level-1"><a href="#attach" class="nav-item">attach</a></li></ul><ul><li class="nav-level-1"><a href="#auth" class="nav-item">auth</a></li><ul id="auth-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-can-i-em-" class="nav-item"><em>can-i</em></a></li><li class="nav-level-2"><a href="#-em-reconcile-em-" class="nav-item"><em>reconcile</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#cp" class="nav-item">cp</a></li></ul><ul><li class="nav-level-1"><a href="#describe" class="nav-item">describe</a></li></ul><ul><li class="nav-level-1"><a href="#exec" class="nav-item">exec</a></li></ul><ul><li class="nav-level-1"><a href="#logs" class="nav-item">logs</a></li></ul><ul><li class="nav-level-1"><a href="#port-forward" class="nav-item">port-forward</a></li></ul><ul><li class="nav-level-1"><a href="#proxy" class="nav-item">proxy</a></li></ul><ul><li class="nav-level-1"><a href="#top" class="nav-item">top</a></li><ul id="top-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-node-em-" class="nav-item"><em>node</em></a></li><li class="nav-level-2"><a href="#-em-pod-em-" class="nav-item"><em>pod</em></a></li></ul></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-cluster-management-strong-" class="nav-item"><strong>CLUSTER MANAGEMENT</strong></a></li></ul><ul><li class="nav-level-1"><a href="#api-versions" class="nav-item">api-versions</a></li></ul><ul><li class="nav-level-1"><a href="#certificate" class="nav-item">certificate</a></li><ul id="certificate-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-approve-em-" class="nav-item"><em>approve</em></a></li><li class="nav-level-2"><a href="#-em-deny-em-" class="nav-item"><em>deny</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#cluster-info" class="nav-item">cluster-info</a></li><ul id="cluster-info-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-dump-em-" class="nav-item"><em>dump</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#cordon" class="nav-item">cordon</a></li></ul><ul><li class="nav-level-1"><a href="#drain" class="nav-item">drain</a></li></ul><ul><li class="nav-level-1"><a href="#taint" class="nav-item">taint</a></li></ul><ul><li class="nav-level-1"><a href="#uncordon" class="nav-item">uncordon</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-kubectl-settings-and-usage-strong-" class="nav-item"><strong>KUBECTL SETTINGS AND USAGE</strong></a></li></ul><ul><li class="nav-level-1"><a href="#alpha" class="nav-item">alpha</a></li><ul id="alpha-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-diff-em-" class="nav-item"><em>diff</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#completion" class="nav-item">completion</a></li></ul><ul><li class="nav-level-1"><a href="#config" class="nav-item">config</a></li><ul id="config-nav" style="display: none;"><li class="nav-level-2"><a href="#-em-current-context-em-" class="nav-item"><em>current-context</em></a></li><li class="nav-level-2"><a href="#-em-delete-cluster-em-" class="nav-item"><em>delete-cluster</em></a></li><li class="nav-level-2"><a href="#-em-delete-context-em-" class="nav-item"><em>delete-context</em></a></li><li class="nav-level-2"><a href="#-em-get-clusters-em-" class="nav-item"><em>get-clusters</em></a></li><li class="nav-level-2"><a href="#-em-get-contexts-em-" class="nav-item"><em>get-contexts</em></a></li><li class="nav-level-2"><a href="#-em-rename-context-em-" class="nav-item"><em>rename-context</em></a></li><li class="nav-level-2"><a href="#-em-set-em-" class="nav-item"><em>set</em></a></li><li class="nav-level-2"><a href="#-em-set-cluster-em-" class="nav-item"><em>set-cluster</em></a></li><li class="nav-level-2"><a href="#-em-set-context-em-" class="nav-item"><em>set-context</em></a></li><li class="nav-level-2"><a href="#-em-set-credentials-em-" class="nav-item"><em>set-credentials</em></a></li><li class="nav-level-2"><a href="#-em-unset-em-" class="nav-item"><em>unset</em></a></li><li class="nav-level-2"><a href="#-em-use-context-em-" class="nav-item"><em>use-context</em></a></li><li class="nav-level-2"><a href="#-em-view-em-" class="nav-item"><em>view</em></a></li></ul></ul><ul><li class="nav-level-1"><a href="#explain" class="nav-item">explain</a></li></ul><ul><li class="nav-level-1"><a href="#options" class="nav-item">options</a></li></ul><ul><li class="nav-level-1"><a href="#version" class="nav-item">version</a></li></ul><ul><li class="nav-level-1"><a href="#plugin" class="nav-item">plugin</a></li></ul><ul><li class="nav-level-1 strong-nav"><a href="#-strong-deprecated-commands-strong-" class="nav-item"><strong>DEPRECATED COMMANDS</strong></a></li></ul><br/><div class="copyright"><a href="https://github.com/kubernetes/kubernetes">Copyright 2016 The Kubernetes Authors.</a></div></div>
<div id="wrapper">
<div id="code-tabs-wrapper" class="code-tabs"><ul class="code-tab-list"><li class="code-tab" id="example">example</li></ul></div>
<div id="page-content-wrapper" class="body-content container-fluid"><h1 id="-strong-getting-started-strong-"><strong>GETTING STARTED</strong></h1>
<p>This section contains the most basic commands for getting a workload
running on your cluster.</p>
<ul>
<li><code>run</code> will start running 1 or more instances of a container image on your cluster.</li>
<li><code>expose</code> will load balance traffic across the running instances, and can create a HA proxy for accessing the containers from outside the cluster.</li>
</ul>
<p>Once your workloads are running, you can use the commands in the
<a href="#-strong-working-with-apps-strong-">WORKING WITH APPS</a> section to
inspect them.</p>
<hr>
<h1 id="run">run</h1>
<blockquote class="code-block example">
<p> Start a single instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and let the container expose port 5701 .</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=hazelcast <span class="hljs-attribute">--port</span>=5701
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and set environment variables &quot;DNS_DOMAIN=cluster&quot; and &quot;POD_NAMESPACE=default&quot; in the container.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=hazelcast <span class="hljs-attribute">--env</span>=<span class="hljs-string">"DNS_DOMAIN=cluster"</span> <span class="hljs-attribute">--env</span>=<span class="hljs-string">"POD_NAMESPACE=default"</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and set labels &quot;app=hazelcast&quot; and &quot;env=prod&quot; in the container.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=nginx <span class="hljs-attribute">--labels</span>=<span class="hljs-string">"app=hazelcast,env=prod"</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a replicated instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx <span class="hljs-attribute">--replicas</span>=5
</code></pre>
<blockquote class="code-block example">
<p> Dry run. Print the corresponding API objects without creating them.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx --dry-run
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl run nginx <span class="hljs-params">--image=nginx</span> <span class="hljs-params">--overrides=</span>'{ <span class="hljs-string">"apiVersion"</span>: <span class="hljs-string">"v1"</span>, <span class="hljs-string">"spec"</span>: { <span class="hljs-string">...</span> } }'
</code></pre>
<blockquote class="code-block example">
<p> Start a pod of busybox and keep it in the foreground, don&#39;t restart it if it exits.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> -i -t busybox <span class="hljs-attribute">--image</span>=busybox <span class="hljs-attribute">--restart</span>=Never
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx -- &lt;arg1&gt; &lt;arg2&gt; <span class="hljs-built_in">..</span>. &lt;argN&gt;
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using a different command and custom arguments.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx --command -- &lt;cmd&gt; &lt;arg1&gt; <span class="hljs-built_in">..</span>. &lt;argN&gt;
</code></pre>
<blockquote class="code-block example">
<p> Start the perl container to compute π to 2000 places and print it out.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> <span class="hljs-literal">pi</span> <span class="hljs-comment">--image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the cron job to compute π to 2000 places and print it out every 5 minutes.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> pi --schedule=<span class="hljs-string">"0/5 * * * ?"</span> --<span class="hljs-built_in">image</span>=perl --restart=OnFailure -- perl -Mbignum=bpi -wle <span class="hljs-string">'print bpi(2000)'</span>
</code></pre>
<p>Create and run a particular image, possibly replicated. </p>
<p>Creates a deployment or job to manage the created container(s).</p>
<h3 id="usage">Usage</h3>
<p><code>$ run NAME --image=image [--env=&quot;key=value&quot;] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>attach</td>
<td></td>
<td>false</td>
<td>If true, wait for the Pod to start running, and then attach to the Pod as if &#39;kubectl attach ...&#39; were called.  Default false, unless &#39;-i/--stdin&#39; is set, in which case the default is true. With &#39;--restart=Never&#39; the exit code of the container process is returned. </td>
</tr>
<tr>
<td>command</td>
<td></td>
<td>false</td>
<td>If true and extra arguments are present, use them as the &#39;command&#39; field in the container, rather than the &#39;args&#39; field which is the default. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>env</td>
<td></td>
<td>[]</td>
<td>Environment variables to set in the container </td>
</tr>
<tr>
<td>expose</td>
<td></td>
<td>false</td>
<td>If true, a public, external service is created for the container(s) which are run </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td></td>
<td>The name of the API generator to use, see <a href="http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators">http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators</a> for a list. </td>
</tr>
<tr>
<td>hostport</td>
<td></td>
<td>-1</td>
<td>The host port mapping for the container port. To demonstrate a single-machine container. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td></td>
<td>The image for the container to run. </td>
</tr>
<tr>
<td>image-pull-policy</td>
<td></td>
<td></td>
<td>The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>labels</td>
<td>l</td>
<td></td>
<td>Comma separated labels to apply to the pod(s). Will override previous values. </td>
</tr>
<tr>
<td>leave-stdin-open</td>
<td></td>
<td>false</td>
<td>If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes. </td>
</tr>
<tr>
<td>limits</td>
<td></td>
<td></td>
<td>The resource requirement limits for this container.  For example, &#39;cpu=200m,memory=512Mi&#39;.  Note that server side components may assign limits depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. </td>
</tr>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>1m0s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
<tr>
<td>port</td>
<td></td>
<td></td>
<td>The port that this container exposes.  If --expose is true, this is also the port used by the service that is created. </td>
</tr>
<tr>
<td>quiet</td>
<td></td>
<td>false</td>
<td>If true, suppress prompt messages. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>replicas</td>
<td>r</td>
<td>1</td>
<td>Number of replicas to create for this container. Default is 1. </td>
</tr>
<tr>
<td>requests</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container.  For example, &#39;cpu=100m,memory=256Mi&#39;.  Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>restart</td>
<td></td>
<td>Always</td>
<td>The restart policy for this Pod.  Legal values [Always, OnFailure, Never].  If set to &#39;Always&#39; a deployment is created, if set to &#39;OnFailure&#39; a job is created, if set to &#39;Never&#39;, a regular pod is created. For the latter two --replicas must be 1.  Default &#39;Always&#39;, for CronJobs <code>Never</code>. </td>
</tr>
<tr>
<td>rm</td>
<td></td>
<td>false</td>
<td>If true, delete resources created in this command for attached containers. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schedule</td>
<td></td>
<td></td>
<td>A schedule in the Cron format the job should be run with. </td>
</tr>
<tr>
<td>service-generator</td>
<td></td>
<td>service/v2</td>
<td>The name of the generator to use for creating a service.  Only used if --expose is true </td>
</tr>
<tr>
<td>service-overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.  Only used if --expose is true. </td>
</tr>
<tr>
<td>serviceaccount</td>
<td></td>
<td></td>
<td>Service account to set in the pod spec </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Keep stdin open on the container(s) in the pod, even if nothing is attached. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Allocated a TTY for each container in the pod. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="run-container">run-container</h1>
<blockquote class="code-block example">
<p> Start a single instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and let the container expose port 5701 .</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=hazelcast <span class="hljs-attribute">--port</span>=5701
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and set environment variables &quot;DNS_DOMAIN=cluster&quot; and &quot;POD_NAMESPACE=default&quot; in the container.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=hazelcast <span class="hljs-attribute">--env</span>=<span class="hljs-string">"DNS_DOMAIN=cluster"</span> <span class="hljs-attribute">--env</span>=<span class="hljs-string">"POD_NAMESPACE=default"</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of hazelcast and set labels &quot;app=hazelcast&quot; and &quot;env=prod&quot; in the container.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> hazelcast <span class="hljs-attribute">--image</span>=nginx <span class="hljs-attribute">--labels</span>=<span class="hljs-string">"app=hazelcast,env=prod"</span>
</code></pre>
<blockquote class="code-block example">
<p> Start a replicated instance of nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx <span class="hljs-attribute">--replicas</span>=5
</code></pre>
<blockquote class="code-block example">
<p> Dry run. Print the corresponding API objects without creating them.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx --dry-run
</code></pre>
<blockquote class="code-block example">
<p> Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl run nginx <span class="hljs-params">--image=nginx</span> <span class="hljs-params">--overrides=</span>'{ <span class="hljs-string">"apiVersion"</span>: <span class="hljs-string">"v1"</span>, <span class="hljs-string">"spec"</span>: { <span class="hljs-string">...</span> } }'
</code></pre>
<blockquote class="code-block example">
<p> Start a pod of busybox and keep it in the foreground, don&#39;t restart it if it exits.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> -i -t busybox <span class="hljs-attribute">--image</span>=busybox <span class="hljs-attribute">--restart</span>=Never
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx -- &lt;arg1&gt; &lt;arg2&gt; <span class="hljs-built_in">..</span>. &lt;argN&gt;
</code></pre>
<blockquote class="code-block example">
<p> Start the nginx container using a different command and custom arguments.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">run</span> nginx <span class="hljs-attribute">--image</span>=nginx --command -- &lt;cmd&gt; &lt;arg1&gt; <span class="hljs-built_in">..</span>. &lt;argN&gt;
</code></pre>
<blockquote class="code-block example">
<p> Start the perl container to compute π to 2000 places and print it out.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> <span class="hljs-literal">pi</span> <span class="hljs-comment">--image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'</span>
</code></pre>
<blockquote class="code-block example">
<p> Start the cron job to compute π to 2000 places and print it out every 5 minutes.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">run</span> pi --schedule=<span class="hljs-string">"0/5 * * * ?"</span> --<span class="hljs-built_in">image</span>=perl --restart=OnFailure -- perl -Mbignum=bpi -wle <span class="hljs-string">'print bpi(2000)'</span>
</code></pre>
<p>Create and run a particular image, possibly replicated. </p>
<p>Creates a deployment or job to manage the created container(s).</p>
<h3 id="usage">Usage</h3>
<p><code>$ run-container</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>attach</td>
<td></td>
<td>false</td>
<td>If true, wait for the Pod to start running, and then attach to the Pod as if &#39;kubectl attach ...&#39; were called.  Default false, unless &#39;-i/--stdin&#39; is set, in which case the default is true. With &#39;--restart=Never&#39; the exit code of the container process is returned. </td>
</tr>
<tr>
<td>command</td>
<td></td>
<td>false</td>
<td>If true and extra arguments are present, use them as the &#39;command&#39; field in the container, rather than the &#39;args&#39; field which is the default. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>env</td>
<td></td>
<td>[]</td>
<td>Environment variables to set in the container </td>
</tr>
<tr>
<td>expose</td>
<td></td>
<td>false</td>
<td>If true, a public, external service is created for the container(s) which are run </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td></td>
<td>The name of the API generator to use, see <a href="http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators">http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators</a> for a list. </td>
</tr>
<tr>
<td>hostport</td>
<td></td>
<td>-1</td>
<td>The host port mapping for the container port. To demonstrate a single-machine container. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td></td>
<td>The image for the container to run. </td>
</tr>
<tr>
<td>image-pull-policy</td>
<td></td>
<td></td>
<td>The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>labels</td>
<td>l</td>
<td></td>
<td>Comma separated labels to apply to the pod(s). Will override previous values. </td>
</tr>
<tr>
<td>leave-stdin-open</td>
<td></td>
<td>false</td>
<td>If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes. </td>
</tr>
<tr>
<td>limits</td>
<td></td>
<td></td>
<td>The resource requirement limits for this container.  For example, &#39;cpu=200m,memory=512Mi&#39;.  Note that server side components may assign limits depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. </td>
</tr>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>1m0s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
<tr>
<td>port</td>
<td></td>
<td></td>
<td>The port that this container exposes.  If --expose is true, this is also the port used by the service that is created. </td>
</tr>
<tr>
<td>quiet</td>
<td></td>
<td>false</td>
<td>If true, suppress prompt messages. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>replicas</td>
<td>r</td>
<td>1</td>
<td>Number of replicas to create for this container. Default is 1. </td>
</tr>
<tr>
<td>requests</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container.  For example, &#39;cpu=100m,memory=256Mi&#39;.  Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>restart</td>
<td></td>
<td>Always</td>
<td>The restart policy for this Pod.  Legal values [Always, OnFailure, Never].  If set to &#39;Always&#39; a deployment is created, if set to &#39;OnFailure&#39; a job is created, if set to &#39;Never&#39;, a regular pod is created. For the latter two --replicas must be 1.  Default &#39;Always&#39;, for CronJobs <code>Never</code>. </td>
</tr>
<tr>
<td>rm</td>
<td></td>
<td>false</td>
<td>If true, delete resources created in this command for attached containers. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>schedule</td>
<td></td>
<td></td>
<td>A schedule in the Cron format the job should be run with. </td>
</tr>
<tr>
<td>service-generator</td>
<td></td>
<td>service/v2</td>
<td>The name of the generator to use for creating a service.  Only used if --expose is true </td>
</tr>
<tr>
<td>service-overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.  Only used if --expose is true. </td>
</tr>
<tr>
<td>serviceaccount</td>
<td></td>
<td></td>
<td>Service account to set in the pod spec </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Keep stdin open on the container(s) in the pod, even if nothing is attached. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Allocated a TTY for each container in the pod. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="expose">expose</h1>
<blockquote class="code-block example">
<p> Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose rc nginx <span class="hljs-attribute">--port</span>=80 <span class="hljs-attribute">--target-port</span>=8000
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replication controller identified by type and name specified in &quot;nginx-controller.yaml&quot;, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose -f nginx-controller.yaml <span class="hljs-attribute">--port</span>=80 <span class="hljs-attribute">--target-port</span>=8000
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a pod valid-pod, which serves on port 444 with the name &quot;frontend&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose pod valid-pod <span class="hljs-attribute">--port</span>=444 <span class="hljs-attribute">--name</span>=frontend
</code></pre>
<blockquote class="code-block example">
<p> Create a second service based on the above service, exposing the container port 8443 as port 443 with the name &quot;nginx-https&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose<span class="hljs-built_in"> service </span>nginx <span class="hljs-attribute">--port</span>=443 <span class="hljs-attribute">--target-port</span>=8443 <span class="hljs-attribute">--name</span>=nginx-https
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named &#39;video-stream&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose rc streamer <span class="hljs-attribute">--port</span>=4100 <span class="hljs-attribute">--protocol</span>=udp <span class="hljs-attribute">--name</span>=video-stream
</code></pre>
<blockquote class="code-block example">
<p> Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose rs nginx <span class="hljs-attribute">--port</span>=80 <span class="hljs-attribute">--target-port</span>=8000
</code></pre>
<blockquote class="code-block example">
<p> Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl expose deployment nginx <span class="hljs-attribute">--port</span>=80 <span class="hljs-attribute">--target-port</span>=8000
</code></pre>
<p>Expose a resource as a new Kubernetes service. </p>
<p>Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes. </p>
<p>Possible resources include (case insensitive): </p>
<p>pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)</p>
<h3 id="usage">Usage</h3>
<p><code>$ expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>cluster-ip</td>
<td></td>
<td></td>
<td>ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to &#39;None&#39; to create a headless service. </td>
</tr>
<tr>
<td>container-port</td>
<td></td>
<td></td>
<td>Synonym for --target-port </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>external-ip</td>
<td></td>
<td></td>
<td>Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to expose a service </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service/v2</td>
<td>The name of the API generator to use. There are 2 generators: &#39;service/v1&#39; and &#39;service/v2&#39;. The only difference between them is that service port in v1 is named &#39;default&#39;, while it is left unnamed in v2. Default is &#39;service/v2&#39;. </td>
</tr>
<tr>
<td>labels</td>
<td>l</td>
<td></td>
<td>Labels to apply to the service created by this call. </td>
</tr>
<tr>
<td>load-balancer-ip</td>
<td></td>
<td></td>
<td>IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific). </td>
</tr>
<tr>
<td>name</td>
<td></td>
<td></td>
<td>The name for the newly created object. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overrides</td>
<td></td>
<td></td>
<td>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. </td>
</tr>
<tr>
<td>port</td>
<td></td>
<td></td>
<td>The port that the service should serve on. Copied from the resource being exposed, if unspecified </td>
</tr>
<tr>
<td>protocol</td>
<td></td>
<td></td>
<td>The network protocol for the service to be created. Default is &#39;TCP&#39;. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>selector</td>
<td></td>
<td></td>
<td>A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.) </td>
</tr>
<tr>
<td>session-affinity</td>
<td></td>
<td></td>
<td>If non-empty, set the session affinity for the service to this; legal values: &#39;None&#39;, &#39;ClientIP&#39; </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>target-port</td>
<td></td>
<td></td>
<td>Name or number for the port on the container that the service should direct traffic to. Optional. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td></td>
<td>Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is &#39;ClusterIP&#39;. </td>
</tr>
</tbody>
</table>
<h1 id="-strong-app-management-strong-"><strong>APP MANAGEMENT</strong></h1>
<p>This section contains commands for creating, updating, deleting, and
viewing your workloads in a Kubernetes cluster.</p>
<hr>
<h1 id="annotate">annotate</h1>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the annotation &#39;description&#39; and the value &#39;my frontend&#39;. # If the same annotation is set multiple times, only the last value will be applied</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl annotate pods foo description</span>=<span class="hljs-string">'my frontend'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update a pod identified by type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate -f pod<span class="hljs-selector-class">.json</span> description=<span class="hljs-string">'my frontend'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the annotation &#39;description&#39; and the value &#39;my frontend running nginx&#39;, overwriting any existing value.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">annotate </span><span class="hljs-built_in">--overwrite</span> <span class="hljs-string">pods </span><span class="hljs-string">foo </span><span class="hljs-string">description=</span><span class="hljs-string">'my frontend running nginx'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update all pods in the namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">annotate </span><span class="hljs-string">pods </span><span class="hljs-built_in">--all</span> <span class="hljs-string">description=</span><span class="hljs-string">'my frontend running nginx'</span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; only if the resource is unchanged from version 1.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate pods foo <span class="hljs-attribute">description</span>=<span class="hljs-string">'my frontend running nginx'</span> <span class="hljs-attribute">--resource-version</span>=1
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; by removing an annotation named &#39;description&#39; if it exists. # Does not require the --overwrite flag.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl annotate pods foo <span class="hljs-keyword">description</span>-
</code></pre>
<p>Update the annotations on one or more resources </p>
<p>All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data. </p>
<p>Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.</p>
<p>Valid resource types include: </p>
<ul>
<li>all  </li>
<li>certificatesigningrequests (aka &#39;csr&#39;)  </li>
<li>clusterrolebindings  </li>
<li>clusterroles  </li>
<li>componentstatuses (aka &#39;cs&#39;)  </li>
<li>configmaps (aka &#39;cm&#39;)  </li>
<li>controllerrevisions  </li>
<li>cronjobs  </li>
<li>customresourcedefinition (aka &#39;crd&#39;)  </li>
<li>daemonsets (aka &#39;ds&#39;)  </li>
<li>deployments (aka &#39;deploy&#39;)  </li>
<li>endpoints (aka &#39;ep&#39;)  </li>
<li>events (aka &#39;ev&#39;)  </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;)  </li>
<li>ingresses (aka &#39;ing&#39;)  </li>
<li>jobs  </li>
<li>limitranges (aka &#39;limits&#39;)  </li>
<li>namespaces (aka &#39;ns&#39;)  </li>
<li>networkpolicies (aka &#39;netpol&#39;)  </li>
<li>nodes (aka &#39;no&#39;)  </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;)  </li>
<li>persistentvolumes (aka &#39;pv&#39;)  </li>
<li>poddisruptionbudgets (aka &#39;pdb&#39;)  </li>
<li>podpreset  </li>
<li>pods (aka &#39;po&#39;)  </li>
<li>podsecuritypolicies (aka &#39;psp&#39;)  </li>
<li>podtemplates  </li>
<li>replicasets (aka &#39;rs&#39;)  </li>
<li>replicationcontrollers (aka &#39;rc&#39;)  </li>
<li>resourcequotas (aka &#39;quota&#39;)  </li>
<li>rolebindings  </li>
<li>roles  </li>
<li>secrets  </li>
<li>serviceaccounts (aka &#39;sa&#39;)  </li>
<li>services (aka &#39;svc&#39;)  </li>
<li>statefulsets (aka &#39;sts&#39;)  </li>
<li>storageclasses (aka &#39;sc&#39;)</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types. </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update the annotation </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, annotation will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2). </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="autoscale">autoscale</h1>
<blockquote class="code-block example">
<p> Auto scale a deployment &quot;foo&quot;, with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl autoscale deployment foo <span class="hljs-attribute">--min</span>=2 <span class="hljs-attribute">--max</span>=10
</code></pre>
<blockquote class="code-block example">
<p> Auto scale a replication controller &quot;foo&quot;, with the number of pods between 1 and 5, target CPU utilization at 80%:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl autoscale rc foo <span class="hljs-attribute">--max</span>=5 <span class="hljs-attribute">--cpu-percent</span>=80
</code></pre>
<p>Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. </p>
<p>Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.</p>
<h3 id="usage">Usage</h3>
<p><code>$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>cpu-percent</td>
<td></td>
<td>-1</td>
<td>The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it&#39;s not specified or negative, a default autoscaling policy will be used. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to autoscale. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>horizontalpodautoscaler/v1</td>
<td>The name of the API generator to use. Currently there is only 1 generator. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>max</td>
<td></td>
<td>-1</td>
<td>The upper limit for the number of pods that can be set by the autoscaler. Required. </td>
</tr>
<tr>
<td>min</td>
<td></td>
<td>-1</td>
<td>The lower limit for the number of pods that can be set by the autoscaler. If it&#39;s not specified or negative, the server will apply a default value. </td>
</tr>
<tr>
<td>name</td>
<td></td>
<td></td>
<td>The name for the newly created object. If not specified, the name of the input resource will be used. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="convert">convert</h1>
<blockquote class="code-block example">
<p> Convert &#39;pod.yaml&#39; to latest version and print to stdout.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">convert</span> <span class="hljs-selector-tag">-f</span> <span class="hljs-selector-tag">pod</span><span class="hljs-selector-class">.yaml</span>
</code></pre>
<blockquote class="code-block example">
<p> Convert the live state of the resource specified by &#39;pod.yaml&#39; to the latest version # and print to stdout in JSON format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">convert</span> -f pod.yaml <span class="hljs-comment">--local -o json</span>
</code></pre>
<blockquote class="code-block example">
<p> Convert all files under current directory to latest version and create them all.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">convert</span> -f . | kubectl <span class="hljs-built_in">create</span> -f -
</code></pre>
<p>Convert config files between different API versions. Both YAML and JSON formats are accepted. </p>
<p>The command takes filename, directory, or URL as input, and convert it into format of version specified by --output-version flag. If target version is not specified or not supported, convert to latest version. </p>
<p>The default output will be printed to stdout in YAML format. One can use -o option to change to output destination.</p>
<h3 id="usage">Usage</h3>
<p><code>$ convert -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to need to get converted. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>true</td>
<td>If true, convert will NOT try to contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>Output the formatted object with the given group version (for ex: &#39;extensions/v1beta1&#39;).) </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="create">create</h1>
<blockquote class="code-block example">
<p> Create a pod using the data in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> -f ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Create a pod based on the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json <span class="hljs-string">| kubectl create -f -</span>
</code></pre>
<blockquote class="code-block example">
<p> Edit the data in docker-registry.yaml in JSON using the v1 API format then create the resource using the edited data.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create -f docker-registry.yaml --<span class="hljs-builtin-name">edit</span> <span class="hljs-attribute">--output-version</span>=v1 -o json
</code></pre>
<p>Create a resource from a file or from stdin. </p>
<p>JSON and YAML formats are accepted.</p>
<h3 id="usage">Usage</h3>
<p><code>$ create -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>edit</td>
<td></td>
<td>false</td>
<td>Edit the API resource before creating </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to create the resource </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>raw</td>
<td></td>
<td></td>
<td>Raw URI to POST to the server.  Uses the transport specified by the kubeconfig file. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>windows-line-endings</td>
<td></td>
<td>false</td>
<td>Only relevant if --edit=true. Defaults to the line ending native to your platform. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-clusterrole-em-"><em>clusterrole</em></h2>
<blockquote class="code-block example">
<p> Create a ClusterRole named &quot;pod-reader&quot; that allows user to perform &quot;get&quot;, &quot;watch&quot; and &quot;list&quot; on pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrole pod-reader <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=pods
</code></pre>
<blockquote class="code-block example">
<p> Create a ClusterRole named &quot;pod-reader&quot; with ResourceName specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrole pod-reader <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=pods <span class="hljs-attribute">--resource-name</span>=readablepod <span class="hljs-attribute">--resource-name</span>=anotherpod
</code></pre>
<blockquote class="code-block example">
<p> Create a ClusterRole named &quot;foo&quot; with API Group specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrole foo <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=rs.extensions
</code></pre>
<blockquote class="code-block example">
<p> Create a ClusterRole named &quot;foo&quot; with SubResource specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrole foo <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=pods,pods/status
</code></pre>
<blockquote class="code-block example">
<p> Create a ClusterRole name &quot;foo&quot; with NonResourceURL specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrole <span class="hljs-string">"foo"</span> <span class="hljs-attribute">--verb</span>=get <span class="hljs-attribute">--non-resource-url</span>=/logs/*
</code></pre>
<p>Create a ClusterRole.</p>
<h3 id="usage">Usage</h3>
<p><code>$ clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>non-resource-url</td>
<td></td>
<td>[]</td>
<td>A partial url that user should have access to. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>resource</td>
<td></td>
<td>[]</td>
<td>Resource that the rule applies to </td>
</tr>
<tr>
<td>resource-name</td>
<td></td>
<td>[]</td>
<td>Resource in the white list that the rule applies to, repeat this flag for multiple items </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>verb</td>
<td></td>
<td>[]</td>
<td>Verb that applies to the resources contained in the rule </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-clusterrolebinding-em-"><em>clusterrolebinding</em></h2>
<blockquote class="code-block example">
<p> Create a ClusterRoleBinding for user1, user2, and group1 using the cluster-admin ClusterRole</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create clusterrolebinding cluster-admin <span class="hljs-attribute">--clusterrole</span>=cluster-admin <span class="hljs-attribute">--user</span>=user1 <span class="hljs-attribute">--user</span>=user2 <span class="hljs-attribute">--group</span>=group1
</code></pre>
<p>Create a ClusterRoleBinding for a particular ClusterRole.</p>
<h3 id="usage">Usage</h3>
<p><code>$ clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>clusterrole</td>
<td></td>
<td></td>
<td>ClusterRole this ClusterRoleBinding should reference </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>clusterrolebinding.rbac.authorization.k8s.io/v1alpha1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>group</td>
<td></td>
<td>[]</td>
<td>Groups to bind to the role </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>serviceaccount</td>
<td></td>
<td>[]</td>
<td>Service accounts to bind to the role, in the format <namespace>:<name> </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-configmap-em-"><em>configmap</em></h2>
<blockquote class="code-block example">
<p> Create a new configmap named my-config based on folder bar</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> configmap my-config --<span class="hljs-keyword">from</span>-file=<span class="hljs-keyword">path</span>/<span class="hljs-keyword">to</span>/bar
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config with specified keys instead of file basenames on disk</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create configmap my-config --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=key1=<span class="hljs-regexp">/path/</span>to<span class="hljs-regexp">/bar/</span>file1.txt --<span class="hljs-keyword">from</span>-<span class="hljs-keyword">file</span>=key2=<span class="hljs-regexp">/path/</span>to<span class="hljs-regexp">/bar/</span>file2.txt
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config with key1=config1 and key2=config2</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create configmap my-config <span class="hljs-attribute">--from-literal</span>=key1=config1 <span class="hljs-attribute">--from-literal</span>=key2=config2
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config from the key=value pairs in the file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> configmap my-config --<span class="hljs-keyword">from</span>-file=<span class="hljs-keyword">path</span>/<span class="hljs-keyword">to</span>/bar
</code></pre>
<blockquote class="code-block example">
<p> Create a new configmap named my-config from an env file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> configmap my-config --<span class="hljs-keyword">from</span>-env-file=<span class="hljs-keyword">path</span>/<span class="hljs-keyword">to</span>/bar.env
</code></pre>
<p>Create a configmap based on a file, directory, or specified literal value. </p>
<p>A single configmap may package one or more key/value pairs. </p>
<p>When creating a configmap based on a file, the key will default to the basename of the file, and the value will default to the file content.  If the basename is an invalid key, you may specify an alternate key. </p>
<p>When creating a configmap based on a directory, each file whose basename is a valid key in the directory will be packaged into the configmap.  Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).</p>
<h3 id="usage">Usage</h3>
<p><code>$ configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>append-hash</td>
<td></td>
<td>false</td>
<td>Append a hash of the configmap to its name. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>from-env-file</td>
<td></td>
<td></td>
<td>Specify the path to a file to read lines of key=val pairs to create a configmap (i.e. a Docker .env file). </td>
</tr>
<tr>
<td>from-file</td>
<td></td>
<td>[]</td>
<td>Key file can be specified using its file path, in which case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will be used.  Specifying a directory will iterate each named file in the directory whose basename is a valid configmap key. </td>
</tr>
<tr>
<td>from-literal</td>
<td></td>
<td>[]</td>
<td>Specify a key and literal value to insert in configmap (i.e. mykey=somevalue) </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>configmap/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-deployment-em-"><em>deployment</em></h2>
<blockquote class="code-block example">
<p> Create a new deployment named my-dep that runs the busybox image.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create deployment <span class="hljs-keyword">my</span>-dep <span class="hljs-comment">--image=busybox</span>
</code></pre>
<p>Create a deployment with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ deployment NAME --image=image [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>deployment-basic/v1beta1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td>[]</td>
<td>Image name to run. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-job-em-"><em>job</em></h2>
<blockquote class="code-block example">
<p> Create a job from a CronJob named &quot;a-cronjob&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">create</span> job <span class="hljs-comment">--from=cronjob/a-cronjob</span>
</code></pre>
<p>Create a job with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ job NAME [--from-cronjob=CRONJOB]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>from</td>
<td></td>
<td></td>
<td>The name of the resource to create a Job from (only cronjob is supported). </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-namespace-em-"><em>namespace</em></h2>
<blockquote class="code-block example">
<p> Create a new namespace named my-namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> <span class="hljs-keyword">namespace</span> my-<span class="hljs-keyword">namespace</span>
</code></pre>
<p>Create a namespace with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ namespace NAME [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>namespace/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-poddisruptionbudget-em-"><em>poddisruptionbudget</em></h2>
<blockquote class="code-block example">
<p> Create a pod disruption budget named my-pdb that will select all pods with the app=rails label # and require at least one of them being available at any point in time.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create poddisruptionbudget my-pdb <span class="hljs-attribute">--selector</span>=app=rails <span class="hljs-attribute">--min-available</span>=1
</code></pre>
<blockquote class="code-block example">
<p> Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create pdb my-pdb <span class="hljs-attribute">--selector</span>=app=nginx <span class="hljs-attribute">--min-available</span>=50%
</code></pre>
<p>Create a pod disruption budget with the specified name, selector, and desired minimum available pods</p>
<h3 id="usage">Usage</h3>
<p><code>$ poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>poddisruptionbudget/v1beta1/v2</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>max-unavailable</td>
<td></td>
<td></td>
<td>The maximum number or percentage of unavailable pods this budget requires. </td>
</tr>
<tr>
<td>min-available</td>
<td></td>
<td></td>
<td>The minimum number or percentage of available pods this budget requires. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>selector</td>
<td></td>
<td></td>
<td>A label selector to use for this budget. Only equality-based selector requirements are supported. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-priorityclass-em-"><em>priorityclass</em></h2>
<blockquote class="code-block example">
<p> Create a priorityclass named high-priority</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create priorityclass default-priority <span class="hljs-attribute">--value</span>=1000 <span class="hljs-attribute">--description</span>=<span class="hljs-string">"high priority"</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a priorityclass named default-priority that considered as the global default priority</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create priorityclass <span class="hljs-keyword">default</span>-priority --<span class="hljs-keyword">value</span>=<span class="hljs-number">1000</span> --<span class="hljs-keyword">global</span>-<span class="hljs-keyword">default</span>=<span class="hljs-literal">true</span> --description=<span class="hljs-string">"default priority"</span>
</code></pre>
<p>Create a priorityclass with the specified name, value, globalDefault and description</p>
<h3 id="usage">Usage</h3>
<p><code>$ priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>description</td>
<td></td>
<td></td>
<td>description is an arbitrary string that usually provides guidelines on when this priority class should be used. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>priorityclass/v1alpha1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>global-default</td>
<td></td>
<td>false</td>
<td>global-default specifies whether this PriorityClass should be considered as the default priority. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>value</td>
<td></td>
<td>0</td>
<td>the value of this priority class. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-quota-em-"><em>quota</em></h2>
<blockquote class="code-block example">
<p> Create a new resourcequota named my-quota</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create quota my-quota --hard=cpu=<span class="hljs-number">1</span>,memory=<span class="hljs-number">1</span>G,pods=<span class="hljs-number">2</span>,services=<span class="hljs-number">3</span>,replicationcontrollers=<span class="hljs-number">2</span>,resourcequotas=<span class="hljs-number">1</span>,secrets=<span class="hljs-number">5</span>,persistentvolumeclaims=<span class="hljs-number">10</span>
</code></pre>
<blockquote class="code-block example">
<p> Create a new resourcequota named best-effort</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create quota best-effort <span class="hljs-attribute">--hard</span>=pods=100 <span class="hljs-attribute">--scopes</span>=BestEffort
</code></pre>
<p>Create a resourcequota with the specified name, hard limits and optional scopes</p>
<h3 id="usage">Usage</h3>
<p><code>$ quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>resourcequotas/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>hard</td>
<td></td>
<td></td>
<td>A comma-delimited set of resource=quantity pairs that define a hard limit. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>scopes</td>
<td></td>
<td></td>
<td>A comma-delimited set of quota scopes that must all match each object tracked by the quota. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-role-em-"><em>role</em></h2>
<blockquote class="code-block example">
<p> Create a Role named &quot;pod-reader&quot; that allows user to perform &quot;get&quot;, &quot;watch&quot; and &quot;list&quot; on pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create role pod-reader <span class="hljs-attribute">--verb</span>=get <span class="hljs-attribute">--verb</span>=list <span class="hljs-attribute">--verb</span>=watch <span class="hljs-attribute">--resource</span>=pods
</code></pre>
<blockquote class="code-block example">
<p> Create a Role named &quot;pod-reader&quot; with ResourceName specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create role pod-reader <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=pods <span class="hljs-attribute">--resource-name</span>=readablepod <span class="hljs-attribute">--resource-name</span>=anotherpod
</code></pre>
<blockquote class="code-block example">
<p> Create a Role named &quot;foo&quot; with API Group specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create role foo <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=rs.extensions
</code></pre>
<blockquote class="code-block example">
<p> Create a Role named &quot;foo&quot; with SubResource specified</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create role foo <span class="hljs-attribute">--verb</span>=get,list,watch <span class="hljs-attribute">--resource</span>=pods,pods/status
</code></pre>
<p>Create a role with single rule.</p>
<h3 id="usage">Usage</h3>
<p><code>$ role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>resource</td>
<td></td>
<td>[]</td>
<td>Resource that the rule applies to </td>
</tr>
<tr>
<td>resource-name</td>
<td></td>
<td>[]</td>
<td>Resource in the white list that the rule applies to, repeat this flag for multiple items </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>verb</td>
<td></td>
<td>[]</td>
<td>Verb that applies to the resources contained in the rule </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-rolebinding-em-"><em>rolebinding</em></h2>
<blockquote class="code-block example">
<p> Create a RoleBinding for user1, user2, and group1 using the admin ClusterRole</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create rolebinding admin <span class="hljs-attribute">--clusterrole</span>=admin <span class="hljs-attribute">--user</span>=user1 <span class="hljs-attribute">--user</span>=user2 <span class="hljs-attribute">--group</span>=group1
</code></pre>
<p>Create a RoleBinding for a particular Role or ClusterRole.</p>
<h3 id="usage">Usage</h3>
<p><code>$ rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>clusterrole</td>
<td></td>
<td></td>
<td>ClusterRole this RoleBinding should reference </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>rolebinding.rbac.authorization.k8s.io/v1alpha1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>group</td>
<td></td>
<td>[]</td>
<td>Groups to bind to the role </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>role</td>
<td></td>
<td></td>
<td>Role this RoleBinding should reference </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>serviceaccount</td>
<td></td>
<td>[]</td>
<td>Service accounts to bind to the role, in the format <namespace>:<name> </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-em-"><em>secret</em></h2>
<p>Create a secret using specified subcommand.</p>
<h3 id="usage">Usage</h3>
<p><code>$ secret</code></p>
<hr>
<h2 id="-em-secret-docker-registry-em-"><em>secret docker-registry</em></h2>
<blockquote class="code-block example">
<p> If you don&#39;t already have a .dockercfg file, you can create a dockercfg secret directly by using:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>docker-registry my-secret <span class="hljs-attribute">--docker-server</span>=DOCKER_REGISTRY_SERVER <span class="hljs-attribute">--docker-username</span>=DOCKER_USER <span class="hljs-attribute">--docker-password</span>=DOCKER_PASSWORD <span class="hljs-attribute">--docker-email</span>=DOCKER_EMAIL
</code></pre>
<p>Create a new secret for use with Docker registries. </p>
<p>Dockercfg secrets are used to authenticate against Docker registries. </p>
<p>When using the Docker command line to push images, you can authenticate to a given registry by running: &#39;$ docker login DOCKER REGISTRY SERVER --username=DOCKER USER --password=DOCKER PASSWORD --email=DOCKER _EMAIL&#39;. </p>
<p>  That produces a ~/.dockercfg file that is used by subsequent &#39;docker push&#39; and &#39;docker pull&#39; commands to</p>
<p>authenticate to the registry. The email address is optional. </p>
<p>When creating applications, you may have a Docker registry that requires authentication.  In order for the nodes to pull images on your behalf, they have to have the credentials.  You can provide this information by creating a dockercfg secret and attaching it to your service account.</p>
<h3 id="usage">Usage</h3>
<p><code>$ docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>append-hash</td>
<td></td>
<td>false</td>
<td>Append a hash of the secret to its name. </td>
</tr>
<tr>
<td>docker-email</td>
<td></td>
<td></td>
<td>Email for Docker registry </td>
</tr>
<tr>
<td>docker-password</td>
<td></td>
<td></td>
<td>Password for Docker registry authentication </td>
</tr>
<tr>
<td>docker-server</td>
<td></td>
<td><a href="https://index.docker.io/v1/">https://index.docker.io/v1/</a></td>
<td>Server location for Docker registry </td>
</tr>
<tr>
<td>docker-username</td>
<td></td>
<td></td>
<td>Username for Docker registry authentication </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret-for-docker-registry/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-generic-em-"><em>secret generic</em></h2>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with keys for each file in folder bar</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>generic my-secret <span class="hljs-attribute">--from-file</span>=path/to/bar
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with specified keys instead of names on disk</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>generic my-secret <span class="hljs-attribute">--from-file</span>=ssh-privatekey=~/.ssh/id_rsa <span class="hljs-attribute">--from-file</span>=ssh-publickey=~/.ssh/id_rsa.pub
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret with key1=supersecret and key2=topsecret</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>generic my-secret <span class="hljs-attribute">--from-literal</span>=key1=supersecret <span class="hljs-attribute">--from-literal</span>=key2=topsecret
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret using a combination of a file and a literal</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>generic my-secret <span class="hljs-attribute">--from-file</span>=ssh-privatekey=~/.ssh/id_rsa <span class="hljs-attribute">--from-literal</span>=passphrase=topsecret
</code></pre>
<blockquote class="code-block example">
<p> Create a new secret named my-secret from an env file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>generic my-secret <span class="hljs-attribute">--from-env-file</span>=path/to/bar.env
</code></pre>
<p>Create a secret based on a file, directory, or specified literal value. </p>
<p>A single secret may package one or more key/value pairs. </p>
<p>When creating a secret based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key or you wish to chose your own, you may specify an alternate key. </p>
<p>When creating a secret based on a directory, each file whose basename is a valid key in the directory will be packaged into the secret. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).</p>
<h3 id="usage">Usage</h3>
<p><code>$ generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>append-hash</td>
<td></td>
<td>false</td>
<td>Append a hash of the secret to its name. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>from-env-file</td>
<td></td>
<td></td>
<td>Specify the path to a file to read lines of key=val pairs to create a secret (i.e. a Docker .env file). </td>
</tr>
<tr>
<td>from-file</td>
<td></td>
<td>[]</td>
<td>Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used.  Specifying a directory will iterate each named file in the directory that is a valid secret key. </td>
</tr>
<tr>
<td>from-literal</td>
<td></td>
<td>[]</td>
<td>Specify a key and literal value to insert in secret (i.e. mykey=somevalue) </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td></td>
<td>The type of secret to create </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-secret-tls-em-"><em>secret tls</em></h2>
<blockquote class="code-block example">
<p> Create a new TLS secret named tls-secret with the given key pair:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> secret </span>tls tls-secret <span class="hljs-attribute">--cert</span>=path/to/tls.cert <span class="hljs-attribute">--key</span>=path/to/tls.key
</code></pre>
<p>Create a TLS secret from the given public/private key pair. </p>
<p>The public/private key pair must exist before hand. The public key certificate must be .PEM encoded and match the given private key.</p>
<h3 id="usage">Usage</h3>
<p><code>$ tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>append-hash</td>
<td></td>
<td>false</td>
<td>Append a hash of the secret to its name. </td>
</tr>
<tr>
<td>cert</td>
<td></td>
<td></td>
<td>Path to PEM encoded public key certificate. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>secret-for-tls/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>key</td>
<td></td>
<td></td>
<td>Path to private key associated with given certificate. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-em-"><em>service</em></h2>
<p>Create a service using specified subcommand.</p>
<h3 id="usage">Usage</h3>
<p><code>$ service</code></p>
<hr>
<h2 id="-em-service-clusterip-em-"><em>service clusterip</em></h2>
<blockquote class="code-block example">
<p> Create a new ClusterIP service named my-cs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> service </span>clusterip my-cs <span class="hljs-attribute">--tcp</span>=5678:8080
</code></pre>
<blockquote class="code-block example">
<p> Create a new ClusterIP service named my-cs (in headless mode)</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> service </span>clusterip my-cs <span class="hljs-attribute">--clusterip</span>=<span class="hljs-string">"None"</span>
</code></pre>
<p>Create a ClusterIP service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ clusterip NAME [--tcp=&lt;port&gt;:&lt;targetPort&gt;] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>clusterip</td>
<td></td>
<td></td>
<td>Assign your own ClusterIP or set to &#39;None&#39; for a &#39;headless&#39; service (no loadbalancing). </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-clusterip/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-externalname-em-"><em>service externalname</em></h2>
<blockquote class="code-block example">
<p> Create a new ExternalName service named my-ns</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> service </span>externalname my-ns --external-name bar.com
</code></pre>
<p>Create an ExternalName service with the specified name. </p>
<p>ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exist off platform, on other clusters, or locally.</p>
<h3 id="usage">Usage</h3>
<p><code>$ externalname NAME --external-name external.name [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>external-name</td>
<td></td>
<td></td>
<td>External name of service </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-externalname/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-loadbalancer-em-"><em>service loadbalancer</em></h2>
<blockquote class="code-block example">
<p> Create a new LoadBalancer service named my-lbs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> service </span>loadbalancer my-lbs <span class="hljs-attribute">--tcp</span>=5678:8080
</code></pre>
<p>Create a LoadBalancer service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ loadbalancer NAME [--tcp=port:targetPort] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-loadbalancer/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-service-nodeport-em-"><em>service nodeport</em></h2>
<blockquote class="code-block example">
<p> Create a new NodePort service named my-ns</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create<span class="hljs-built_in"> service </span>nodeport my-ns <span class="hljs-attribute">--tcp</span>=5678:8080
</code></pre>
<p>Create a NodePort service with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ nodeport NAME [--tcp=port:targetPort] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>service-nodeport/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>node-port</td>
<td></td>
<td>0</td>
<td>Port used to expose the service on each node in a cluster. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>tcp</td>
<td></td>
<td>[]</td>
<td>Port pairs can be specified as &#39;<port>:<targetPort>&#39;. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-serviceaccount-em-"><em>serviceaccount</em></h2>
<blockquote class="code-block example">
<p> Create a new service account named my-service-account</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">create</span> serviceaccount my-service-<span class="hljs-keyword">account</span>
</code></pre>
<p>Create a service account with the specified name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ serviceaccount NAME [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>generator</td>
<td></td>
<td>serviceaccount/v1</td>
<td>The name of the API generator to use. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="delete">delete</h1>
<blockquote class="code-block example">
<p> Delete a pod using the type and name specified in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">delete</span> -f ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Delete a pod based on the type and name in the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">cat</span> pod.json | kubectl <span class="hljs-keyword">delete</span> -<span class="hljs-keyword">f</span> -
</code></pre>
<blockquote class="code-block example">
<p> Delete pods and services with same names &quot;baz&quot; and &quot;foo&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">delete</span> pod,service baz foo
</code></pre>
<blockquote class="code-block example">
<p> Delete pods and services with label name=myLabel.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl delete pods,services -l <span class="hljs-attribute">name</span>=myLabel
</code></pre>
<blockquote class="code-block example">
<p> Delete a pod with minimal delay</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">delete</span> pod foo <span class="hljs-comment">--now</span>
</code></pre>
<blockquote class="code-block example">
<p> Force delete a pod on a dead node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">delete</span> <span class="hljs-comment">pod</span> <span class="hljs-comment">foo</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">grace</span><span class="hljs-literal">-</span><span class="hljs-comment">period=0</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">force</span>
</code></pre>
<blockquote class="code-block example">
<p> Delete all pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">delete</span> pods <span class="hljs-comment">--all</span>
</code></pre>
<p>Delete resources by filenames, stdin, resources and names, or by resources and label selector. </p>
<p>JSON and YAML formats are accepted. Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector. </p>
<p>Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must pass a grace period of 0 and specify the --force flag. </p>
<p>IMPORTANT: Force deleting pods does not wait for confirmation that the pod&#39;s processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately. </p>
<p>Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.</p>
<h3 id="usage">Usage</h3>
<p><code>$ delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Delete all resources, including uninitialized ones, in the namespace of the specified resource types. </td>
</tr>
<tr>
<td>cascade</td>
<td></td>
<td>true</td>
<td>If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController).  Default true. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files containing the resource to delete. </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>ignore-not-found</td>
<td></td>
<td>false</td>
<td>Treat &quot;resource not found&quot; as a successful delete. Defaults to &quot;true&quot; when --all is specified. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>now</td>
<td></td>
<td>false</td>
<td>If true, resources are signaled for immediate shutdown (same as --grace-period=1). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="edit">edit</h1>
<blockquote class="code-block example">
<p> Edit the service named &#39;docker-registry&#39;:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">edit</span> svc/docker-registry
</code></pre>
<blockquote class="code-block example">
<p> Use an alternative editor</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">KUBE_EDITOR</span>=<span class="hljs-string">"nano"</span> kubectl <span class="hljs-builtin-name">edit</span> svc/docker-registry
</code></pre>
<blockquote class="code-block example">
<p> Edit the job &#39;myjob&#39; in JSON using the v1 API format:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl edit job<span class="hljs-selector-class">.v1</span><span class="hljs-selector-class">.batch</span>/myjob -o json
</code></pre>
<blockquote class="code-block example">
<p> Edit the deployment &#39;mydeployment&#39; in YAML and save the modified config in its annotation:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">edit</span> deployment/mydeployment -o yaml --<span class="hljs-keyword">save</span>-config
</code></pre>
<p>Edit a resource from the default editor. </p>
<p>The edit command allows you to directly edit any API resource you can retrieve via the command line tools. It will open the editor defined by your KUBE _EDITOR, or EDITOR environment variables, or fall back to &#39;vi&#39; for Linux or &#39;notepad&#39; for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts filenames as well as command line arguments, although the files you point to must be previously saved versions of resources. </p>
<p>Editing is done with the API version used to fetch the resource. To edit using a specific API version, fully-qualify the resource, version, and group. </p>
<p>The default format is YAML. To edit in JSON, specify &quot;-o json&quot;. </p>
<p>The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used. </p>
<p>In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.</p>
<h3 id="usage">Usage</h3>
<p><code>$ edit (RESOURCE/NAME | -f FILENAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to edit the resource </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td>yaml</td>
<td>Output format. One of: yaml&#124;json. </td>
</tr>
<tr>
<td>output-patch</td>
<td></td>
<td>false</td>
<td>Output the patch if the resource is edited. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
<tr>
<td>windows-line-endings</td>
<td></td>
<td>false</td>
<td>Defaults to the line ending native to your platform. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="get">get</h1>
<blockquote class="code-block example">
<p> List all pods in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> pods
</code></pre>
<blockquote class="code-block example">
<p> List all pods in ps output format with more information (such as node name).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> pods -o wide
</code></pre>
<blockquote class="code-block example">
<p> List a single replication controller with specified NAME in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> replicationcontroller web
</code></pre>
<blockquote class="code-block example">
<p> List a single pod in JSON output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> -o json pod web-pod-13je7
</code></pre>
<blockquote class="code-block example">
<p> List a pod identified by type and name specified in &quot;pod.yaml&quot; in JSON output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> -f pod.yaml -o json
</code></pre>
<blockquote class="code-block example">
<p> Return only the phase value of the specified pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">get</span> -o <span class="hljs-keyword">template</span> pod/web-pod<span class="hljs-number">-13</span>je7 --<span class="hljs-keyword">template</span>={{.status.phase}}
</code></pre>
<blockquote class="code-block example">
<p> List all replication controllers and services together in ps output format.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> rc,services
</code></pre>
<blockquote class="code-block example">
<p> List one or more resources by their type and names.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">get</span> rc/web service/frontend pods/web-pod-13je7
</code></pre>
<blockquote class="code-block example">
<p> List all resources with different types.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">get</span> <span class="hljs-built_in">all</span>
</code></pre>
<p>Display one or many resources </p>
<p>Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your current namespace unless you pass --all-namespaces. </p>
<p>Uninitialized objects are not shown unless --include-uninitialized is passed. </p>
<p>By specifying the output as &#39;template&#39; and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resources.</p>
<p>Valid resource types include: </p>
<ul>
<li>all  </li>
<li>certificatesigningrequests (aka &#39;csr&#39;)  </li>
<li>clusterrolebindings  </li>
<li>clusterroles  </li>
<li>componentstatuses (aka &#39;cs&#39;)  </li>
<li>configmaps (aka &#39;cm&#39;)  </li>
<li>controllerrevisions  </li>
<li>cronjobs  </li>
<li>customresourcedefinition (aka &#39;crd&#39;)  </li>
<li>daemonsets (aka &#39;ds&#39;)  </li>
<li>deployments (aka &#39;deploy&#39;)  </li>
<li>endpoints (aka &#39;ep&#39;)  </li>
<li>events (aka &#39;ev&#39;)  </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;)  </li>
<li>ingresses (aka &#39;ing&#39;)  </li>
<li>jobs  </li>
<li>limitranges (aka &#39;limits&#39;)  </li>
<li>namespaces (aka &#39;ns&#39;)  </li>
<li>networkpolicies (aka &#39;netpol&#39;)  </li>
<li>nodes (aka &#39;no&#39;)  </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;)  </li>
<li>persistentvolumes (aka &#39;pv&#39;)  </li>
<li>poddisruptionbudgets (aka &#39;pdb&#39;)  </li>
<li>podpreset  </li>
<li>pods (aka &#39;po&#39;)  </li>
<li>podsecuritypolicies (aka &#39;psp&#39;)  </li>
<li>podtemplates  </li>
<li>replicasets (aka &#39;rs&#39;)  </li>
<li>replicationcontrollers (aka &#39;rc&#39;)  </li>
<li>resourcequotas (aka &#39;quota&#39;)  </li>
<li>rolebindings  </li>
<li>roles  </li>
<li>secrets  </li>
<li>serviceaccounts (aka &#39;sa&#39;)  </li>
<li>services (aka &#39;svc&#39;)  </li>
<li>statefulsets (aka &#39;sts&#39;)  </li>
<li>storageclasses (aka &#39;sc&#39;)</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>chunk-size</td>
<td></td>
<td>500</td>
<td>Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future. </td>
</tr>
<tr>
<td>experimental-server-print</td>
<td></td>
<td>false</td>
<td>If true, have the server return the appropriate table output. Supports extension APIs and CRD. Experimental. </td>
</tr>
<tr>
<td>export</td>
<td></td>
<td>false</td>
<td>If true, use &#39;export&#39; for the resources.  Exported resources are stripped of cluster-specific information. </td>
</tr>
<tr>
<td>field-selector</td>
<td></td>
<td></td>
<td>Selector (field query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>ignore-not-found</td>
<td></td>
<td>false</td>
<td>If the requested object does not exist the command will return exit code 0. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>label-columns</td>
<td>L</td>
<td>[]</td>
<td>Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>raw</td>
<td></td>
<td></td>
<td>Raw URI to request from the server.  Uses the transport specified by the kubeconfig file. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-kind</td>
<td></td>
<td>false</td>
<td>If present, list the resource type for the requested object(s). </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>use-openapi-print-columns</td>
<td></td>
<td>true</td>
<td>If true, use x-kubernetes-print-column metadata (if present) from the OpenAPI schema for displaying a resource. </td>
</tr>
<tr>
<td>watch</td>
<td>w</td>
<td>false</td>
<td>After listing/getting the requested object, watch for changes. Uninitialized objects are excluded if no object name is provided. </td>
</tr>
<tr>
<td>watch-only</td>
<td></td>
<td>false</td>
<td>Watch for changes to the requested object(s), without listing/getting first. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="label">label</h1>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the label &#39;unhealthy&#39; and the value &#39;true&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods foo unhealthy=<span class="hljs-literal">true</span></span>
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; with the label &#39;status&#39; and the value &#39;unhealthy&#39;, overwriting any existing value.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> --overwrite pods foo status=unhealthy</span>
</code></pre>
<blockquote class="code-block example">
<p> Update all pods in the namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods --all status=unhealthy</span>
</code></pre>
<blockquote class="code-block example">
<p> Update a pod identified by the type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-selector-tag">label</span> -f pod<span class="hljs-selector-class">.json</span> status=unhealthy
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; only if the resource is unchanged from version 1.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl label pods foo <span class="hljs-attribute">status</span>=unhealthy <span class="hljs-attribute">--resource-version</span>=1
</code></pre>
<blockquote class="code-block example">
<p> Update pod &#39;foo&#39; by removing a label named &#39;bar&#39; if it exists. # Does not require the --overwrite flag.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">label</span><span class="bash"> pods foo bar-</span>
</code></pre>
<p>Update the labels on a resource. </p>
<ul>
<li>A label key and value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to  63 characters each.  </li>
<li>Optionally, the key can begin with a DNS subdomain prefix and a single &#39;/&#39;, like example.com/my-app  </li>
<li>If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error.  </li>
<li>If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update the labels </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>list</td>
<td></td>
<td>false</td>
<td>If true, display the labels for a given resource. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, label will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>If non-empty, the labels update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2). </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="patch">patch</h1>
<blockquote class="code-block example">
<p> Partially update a node using a strategic merge patch. Specify the patch as JSON.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch <span class="hljs-keyword">node</span> <span class="hljs-title">k8s-node-1</span> -p '{<span class="hljs-string">"spec"</span>:{<span class="hljs-string">"unschedulable"</span>:<span class="hljs-literal">true</span>}}'
</code></pre>
<blockquote class="code-block example">
<p> Partially update a node using a strategic merge patch. Specify the patch as YAML.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch <span class="hljs-keyword">node</span> <span class="hljs-title">k8s-node-1</span> -p $'<span class="hljs-keyword">spec</span>:\n unschedulable: <span class="hljs-literal">true</span>'
</code></pre>
<blockquote class="code-block example">
<p> Partially update a node identified by the type and name specified in &quot;node.json&quot; using strategic merge patch.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch -f <span class="hljs-keyword">node</span>.<span class="hljs-title">json</span> -p '{<span class="hljs-string">"spec"</span>:{<span class="hljs-string">"unschedulable"</span>:<span class="hljs-literal">true</span>}}'
</code></pre>
<blockquote class="code-block example">
<p> Update a container&#39;s image; spec.containers[*].name is required because it&#39;s a merge key.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">patch</span> pod valid-pod -p '{<span class="hljs-string">"spec"</span>:{<span class="hljs-string">"containers"</span>:[{<span class="hljs-string">"name"</span>:<span class="hljs-string">"kubernetes-serve-hostname"</span>,<span class="hljs-string">"image"</span>:<span class="hljs-string">"new image"</span>}]}}'
</code></pre>
<blockquote class="code-block example">
<p> Update a container&#39;s image using a json patch with positional arrays.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl patch pod valid-pod --<span class="hljs-class"><span class="hljs-keyword">type</span></span>=<span class="hljs-symbol">'jso</span>n' -p='[{<span class="hljs-string">"op"</span>: <span class="hljs-string">"replace"</span>, <span class="hljs-string">"path"</span>: <span class="hljs-string">"/spec/containers/0/image"</span>, <span class="hljs-string">"value"</span>:<span class="hljs-string">"new image"</span>}]'
</code></pre>
<p>Update field(s) of a resource using strategic merge patch, a JSON merge patch, or a JSON patch. </p>
<p>JSON and YAML formats are accepted. </p>
<p>Please refer to the models in <a href="https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html">https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html</a> to find if a field is mutable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ patch (-f FILENAME | TYPE NAME) -p PATCH</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, patch will operate on the content of the file, not the server-side resource. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>patch</td>
<td>p</td>
<td></td>
<td>The patch to be applied to the resource JSON file. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>type</td>
<td></td>
<td>strategic</td>
<td>The type of patch being provided; one of [json merge strategic] </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="replace">replace</h1>
<blockquote class="code-block example">
<p> Replace a pod using the data in pod.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">replace</span> -f ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Replace a pod based on the JSON passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">replace</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Update a single-container pod&#39;s image version (tag) to v4</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl get pod mypod -o yaml | <span class="hljs-type">sed</span> 's/\(image: myimage\):.*$/\<span class="hljs-number">1</span>:v4/' | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">replace</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Force replace, delete and then re-create the resource</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl replace <span class="hljs-params">--force</span> -f <span class="hljs-string">./pod.json</span>
</code></pre>
<p>Replace a resource by filename or stdin. </p>
<p>JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by </p>
<p>  $ kubectl get TYPE NAME -o yaml</p>
<p>Please refer to the models in <a href="https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html">https://htmlpreview.github.io/?https://github.com/kubernetes/kubernetes/blob/HEAD/docs/api-reference/v1/definitions.html</a> to find if a field is mutable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ replace -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>cascade</td>
<td></td>
<td>false</td>
<td>Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to replace the resource. </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Delete and re-create the specified resource </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>save-config</td>
<td></td>
<td>false</td>
<td>If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="rolling-update">rolling-update</h1>
<blockquote class="code-block example">
<p> Update pods of frontend-v1 using new replication controller data in frontend-v2.json.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> -f frontend-<span class="hljs-built_in">v2</span>.json
</code></pre>
<blockquote class="code-block example">
<p> Update pods of frontend-v1 using JSON data passed into stdin.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">cat</span> frontend-v2.json | kubectl <span class="hljs-keyword">rolling</span>-<span class="hljs-keyword">update</span> frontend-v1 -f -
</code></pre>
<blockquote class="code-block example">
<p> Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the # name of the replication controller.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> frontend-<span class="hljs-built_in">v2</span> --image<span class="hljs-symbol">=image</span>:<span class="hljs-built_in">v2</span>
</code></pre>
<blockquote class="code-block example">
<p> Update the pods of frontend by just changing the image, and keeping the old name.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rolling-update frontend --<span class="hljs-built_in">image</span>=<span class="hljs-built_in">image</span>:v2
</code></pre>
<blockquote class="code-block example">
<p> Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> rolling-update frontend-<span class="hljs-built_in">v1</span> frontend-<span class="hljs-built_in">v2</span> --rollback
</code></pre>
<p>Perform a rolling update of the given ReplicationController. </p>
<p>Replaces the specified replication controller with a new replication controller by updating one pod at a time to use the new PodTemplate. The new-controller.json must specify the same namespace as the existing replication controller and overwrite at least one (common) label in its replicaSelector. </p>
<p>! <a href="http://kubernetes.io/images/docs/kubectl_rollingupdate.svg">http://kubernetes.io/images/docs/kubectl_rollingupdate.svg</a></p>
<h3 id="usage">Usage</h3>
<p><code>$ rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>container</td>
<td></td>
<td></td>
<td>Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod </td>
</tr>
<tr>
<td>deployment-label-key</td>
<td></td>
<td>deployment</td>
<td>The key to use to differentiate between two different controllers, default &#39;deployment&#39;.  Only relevant when --image is specified, ignored otherwise </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename or URL to file to use to create the new replication controller. </td>
</tr>
<tr>
<td>image</td>
<td></td>
<td></td>
<td>Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag).  Can not be used with --filename/-f </td>
</tr>
<tr>
<td>image-pull-policy</td>
<td></td>
<td></td>
<td>Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>poll-interval</td>
<td></td>
<td>3s</td>
<td>Time delay between polling for replication controller status after the update. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>rollback</td>
<td></td>
<td>false</td>
<td>If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>5m0s</td>
<td>Max time to wait for a replication controller to update before giving up. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>update-period</td>
<td></td>
<td>1m0s</td>
<td>Time to wait between updating pods. Valid time units are &quot;ns&quot;, &quot;us&quot; (or &quot;µs&quot;), &quot;ms&quot;, &quot;s&quot;, &quot;m&quot;, &quot;h&quot;. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="rollout">rollout</h1>
<blockquote class="code-block example">
<p> Rollback to the previous deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<blockquote class="code-block example">
<p> Check the rollout status of a daemonset</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">status</span> daemonset/foo
</code></pre>
<p>Manage the rollout of a resource.</p>
<p>Valid resource types include: </p>
<ul>
<li>deployments  </li>
<li>daemonsets  </li>
<li>statefulsets</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ rollout SUBCOMMAND</code></p>
<hr>
<h2 id="-em-history-em-"><em>history</em></h2>
<blockquote class="code-block example">
<p> View the rollout history of a deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">history</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<blockquote class="code-block example">
<p> View the details of daemonset revision 3</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">history</span> daemonset/abc <span class="hljs-params">--revision=3</span>
</code></pre>
<p>View previous rollout revisions and configurations.</p>
<h3 id="usage">Usage</h3>
<p><code>$ history (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>revision</td>
<td></td>
<td>0</td>
<td>See the details, including podTemplate of the revision specified </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-pause-em-"><em>pause</em></h2>
<blockquote class="code-block example">
<p> Mark the nginx deployment as paused. Any current state of # the deployment will continue its function, new updates to the deployment will not # have an effect as long as the deployment is paused.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">pause</span> deployment/nginx
</code></pre>
<p>Mark the provided resource as paused </p>
<p>Paused resources will not be reconciled by a controller. Use &quot;kubectl rollout resume&quot; to resume a paused resource. Currently only deployments support being paused.</p>
<h3 id="usage">Usage</h3>
<p><code>$ pause RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-resume-em-"><em>resume</em></h2>
<blockquote class="code-block example">
<p> Resume an already paused deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">resume</span> deployment/nginx
</code></pre>
<p>Resume a paused resource </p>
<p>Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.</p>
<h3 id="usage">Usage</h3>
<p><code>$ resume RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-status-em-"><em>status</em></h2>
<blockquote class="code-block example">
<p> Watch the rollout status of a deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">status</span> deployment/nginx
</code></pre>
<p>Show the status of the rollout. </p>
<p>By default &#39;rollout status&#39; will watch the status of the latest rollout until it&#39;s done. If you don&#39;t want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then &#39;rollout status&#39; will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, use --revision=N where N is the revision you need to watch for.</p>
<h3 id="usage">Usage</h3>
<p><code>$ status (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>revision</td>
<td></td>
<td>0</td>
<td>Pin to a specific revision for showing its status. Defaults to 0 (last revision). </td>
</tr>
<tr>
<td>watch</td>
<td>w</td>
<td>true</td>
<td>Watch the status of the rollout until it&#39;s done. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-undo-em-"><em>undo</em></h2>
<blockquote class="code-block example">
<p> Rollback to the previous deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> deployment/<span class="hljs-keyword">abc</span>
</code></pre>
<blockquote class="code-block example">
<p> Rollback to daemonset revision 3</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout <span class="hljs-keyword">undo</span> daemonset/<span class="hljs-keyword">abc</span> --<span class="hljs-keyword">to</span>-revision=<span class="hljs-number">3</span>
</code></pre>
<blockquote class="code-block example">
<p> Rollback to the previous deployment with dry-run</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl rollout undo --dry-<span class="hljs-keyword">run</span><span class="bash">=<span class="hljs-literal">true</span> deployment/abc</span>
</code></pre>
<p>Rollback to a previous rollout.</p>
<h3 id="usage">Usage</h3>
<p><code>$ undo (TYPE NAME | TYPE/NAME) [flags]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>to-revision</td>
<td></td>
<td>0</td>
<td>The revision to rollback to. Default to 0 (last revision). </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="scale">scale</h1>
<blockquote class="code-block example">
<p> Scale a replicaset named &#39;foo&#39; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-attribute">--replicas</span>=3 rs/foo
</code></pre>
<blockquote class="code-block example">
<p> Scale a resource identified by type and name specified in &quot;foo.yaml&quot; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-attribute">--replicas</span>=3 -f foo.yaml
</code></pre>
<blockquote class="code-block example">
<p> If the deployment named mysql&#39;s current size is 2, scale mysql to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-attribute">--current-replicas</span>=2 <span class="hljs-attribute">--replicas</span>=3 deployment/mysql
</code></pre>
<blockquote class="code-block example">
<p> Scale multiple replication controllers.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">scale</span> --replicas=<span class="hljs-number">5</span> rc/foo rc/<span class="hljs-built_in">bar</span> rc/baz
</code></pre>
<blockquote class="code-block example">
<p> Scale statefulset named &#39;web&#39; to 3.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl scale <span class="hljs-attribute">--replicas</span>=3 statefulset/web
</code></pre>
<p>Set a new size for a Deployment, ReplicaSet, Replication Controller, or StatefulSet. </p>
<p>Scale also allows users to specify one or more preconditions for the scale action. </p>
<p>If --current-replicas or --resource-version is specified, it is validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server.</p>
<h3 id="usage">Usage</h3>
<p><code>$ scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>current-replicas</td>
<td></td>
<td>-1</td>
<td>Precondition for current size. Requires that the current size of the resource match this value in order to scale. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to set a new size </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>replicas</td>
<td></td>
<td>-1</td>
<td>The new desired number of replicas. Required. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>Precondition for resource version. Requires that the current resource version match this value in order to scale. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up on a scale operation, zero means don&#39;t wait. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="set">set</h1>
<p>Configure application resources </p>
<p>These commands help you make changes to existing application resources.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set SUBCOMMAND</code></p>
<hr>
<h2 id="-em-env-em-"><em>env</em></h2>
<blockquote class="code-block example">
<p> Update deployment &#39;registry&#39; with a new environment variable</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> env deployment/registry <span class="hljs-attribute">STORAGE_DIR</span>=/local
</code></pre>
<blockquote class="code-block example">
<p> List the environment variables defined on a deployments &#39;sample-build&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> env deployment/<span class="hljs-keyword">sample</span>-<span class="hljs-keyword">build</span> <span class="hljs-comment">--list</span>
</code></pre>
<blockquote class="code-block example">
<p> List the environment variables defined on all pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> env pods <span class="hljs-params">--all</span> <span class="hljs-params">--list</span>
</code></pre>
<blockquote class="code-block example">
<p> Output modified deployment in YAML, and does not alter the object on the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> env deployment/sample-build <span class="hljs-attribute">STORAGE_DIR</span>=/data -o yaml
</code></pre>
<blockquote class="code-block example">
<p> Update all containers in all replication controllers in the project to have ENV=prod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> env rc --all <span class="hljs-attribute">ENV</span>=prod
</code></pre>
<blockquote class="code-block example">
<p> Import environment from a secret</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> env <span class="hljs-attribute">--from</span>=secret/mysecret deployment/myapp
</code></pre>
<blockquote class="code-block example">
<p> Import environment from a config map with a prefix</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> env <span class="hljs-attribute">--from</span>=configmap/myconfigmap <span class="hljs-attribute">--prefix</span>=MYSQL_ deployment/myapp
</code></pre>
<blockquote class="code-block example">
<p> Remove the environment variable ENV from container &#39;c1&#39; in all deployment configs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> env deployments <span class="hljs-params">--all</span> <span class="hljs-params">--containers=</span><span class="hljs-string">"c1"</span> ENV-
</code></pre>
<blockquote class="code-block example">
<p> Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl set <span class="hljs-keyword">env</span> -f deploy.json <span class="hljs-keyword">ENV</span>-
</code></pre>
<blockquote class="code-block example">
<p> Set some of the local shell environment into a deployment config on the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">env | <span class="hljs-type">grep</span> RAILS_ | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">set</span> env -e - deployment/registry
</code></pre>
<p>Update environment variables on a pod template. </p>
<p>List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers or deployment configurations). View or modify the environment variable definitions on all containers in the specified pods or pod templates, or just those that match a wildcard. </p>
<p>If &quot;--env -&quot; is passed, environment variables can be read from STDIN using the standard env syntax. </p>
<p>Possible resources include (case insensitive): </p>
<p>  pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)</p>
<h3 id="usage">Usage</h3>
<p><code>$ env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>If true, select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>containers</td>
<td>c</td>
<td>*</td>
<td>The names of containers in the selected pod templates to change - may use wildcards </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>env</td>
<td>e</td>
<td>[]</td>
<td>Specify a key-value pair for an environment variable to set into each container. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files the resource to update the env </td>
</tr>
<tr>
<td>from</td>
<td></td>
<td></td>
<td>The name of a resource from which to inject environment variables </td>
</tr>
<tr>
<td>list</td>
<td></td>
<td>false</td>
<td>If true, display the environment and any changes in the standard format. this flag will removed when we have kubectl view env. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set env will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>true</td>
<td>If true, allow environment to be overwritten, otherwise reject updates that overwrite existing environment. </td>
</tr>
<tr>
<td>prefix</td>
<td></td>
<td></td>
<td>Prefix to append to variable names </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resolve</td>
<td></td>
<td>false</td>
<td>If true, show secret or configmap references when listing variables </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-image-em-"><em>image</em></h2>
<blockquote class="code-block example">
<p> Set a deployment&#39;s nginx container image to &#39;nginx:1.9.1&#39;, and its busybox container image to &#39;busybox&#39;.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> image deployment/nginx <span class="hljs-attribute">busybox</span>=busybox <span class="hljs-attribute">nginx</span>=nginx:1.9.1
</code></pre>
<blockquote class="code-block example">
<p> Update all deployments&#39; and rc&#39;s nginx container&#39;s image to &#39;nginx:1.9.1&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> image deployments,rc <span class="hljs-attribute">nginx</span>=nginx:1.9.1 --all
</code></pre>
<blockquote class="code-block example">
<p> Update image of all containers of daemonset abc to &#39;nginx:1.9.1&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> image <span class="hljs-comment">daemonset abc *=nginx:1.9.1</span>
</code></pre>
<blockquote class="code-block example">
<p> Print result (in yaml format) of updating nginx container image from local file, without hitting the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> image -f path/<span class="hljs-keyword">to</span>/file.yaml <span class="hljs-attribute">nginx</span>=nginx:1.9.1 --local -o yaml
</code></pre>
<p>Update existing container image(s) of resources. </p>
<p>Possible resources include (case insensitive): </p>
<p>  pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)</p>
<h3 id="usage">Usage</h3>
<p><code>$ image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set image will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-resources-em-"><em>resources</em></h2>
<blockquote class="code-block example">
<p> Set a deployments nginx container cpu limits to &quot;200m&quot; and memory to &quot;512Mi&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> resources deployment nginx <span class="hljs-attribute">-c</span>=nginx <span class="hljs-attribute">--limits</span>=cpu=200m,memory=512Mi
</code></pre>
<blockquote class="code-block example">
<p> Set the resource request and limits for all containers in nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> resources deployment nginx <span class="hljs-attribute">--limits</span>=cpu=200m,memory=512Mi <span class="hljs-attribute">--requests</span>=cpu=100m,memory=256Mi
</code></pre>
<blockquote class="code-block example">
<p> Remove the resource requests for resources on containers in nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> resources deployment nginx <span class="hljs-attribute">--limits</span>=cpu=0,memory=0 <span class="hljs-attribute">--requests</span>=cpu=0,memory=0
</code></pre>
<blockquote class="code-block example">
<p> Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> resources -f path/<span class="hljs-keyword">to</span>/file.yaml <span class="hljs-attribute">--limits</span>=cpu=200m,memory=512Mi --local -o yaml
</code></pre>
<p>Specify compute resource requirements (cpu, memory) for any resource that defines a pod template.  If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits. </p>
<p>for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit. </p>
<p>Possible resources include (case insensitive): replicationcontroller, deployment, daemonset, job, replicaset.</p>
<h3 id="usage">Usage</h3>
<p><code>$ resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS &amp; --requests=REQUESTS]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>containers</td>
<td>c</td>
<td>*</td>
<td>The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>limits</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container.  For example, &#39;cpu=100m,memory=256Mi&#39;.  Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set resources will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>requests</td>
<td></td>
<td></td>
<td>The resource requirement requests for this container.  For example, &#39;cpu=100m,memory=256Mi&#39;.  Note that server side components may assign requests depending on the server configuration, such as limit ranges. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones,supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-selector-em-"><em>selector</em></h2>
<blockquote class="code-block example">
<p> set the labels and selector before creating a deployment/service pair.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create service clusterip my-svc --clusterip=<span class="hljs-string">"None"</span> -o yaml --dry-<span class="hljs-keyword">run</span><span class="bash"> | kubectl <span class="hljs-built_in">set</span> selector --<span class="hljs-built_in">local</span> -f - <span class="hljs-string">'environment=qa'</span> -o yaml | kubectl create -f -
</span>kubectl create deployment my-dep -o yaml --dry-<span class="hljs-keyword">run</span><span class="bash"> | kubectl label --<span class="hljs-built_in">local</span> -f - environment=qa -o yaml | kubectl create -f -</span>
</code></pre>
<p>Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of &#39;set selector&#39;. </p>
<p>A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to  63 characters. If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. Note: currently selectors can only be set on Service objects.</p>
<h3 id="usage">Usage</h3>
<p><code>$ selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files the resource to update the selectors </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set selector will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>resource-version</td>
<td></td>
<td></td>
<td>If non-empty, the selectors update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-serviceaccount-em--1"><em>serviceaccount</em></h2>
<blockquote class="code-block example">
<p> Set Deployment nginx-deployment&#39;s ServiceAccount to serviceaccount1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">set</span> serviceaccount <span class="hljs-comment">deployment nginx-deployment serviceaccount1</span>
</code></pre>
<blockquote class="code-block example">
<p> Print the result (in yaml format) of updated nginx deployment with serviceaccount from local file, without hitting apiserver</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> sa -f nginx-deployment.yaml serviceaccount1 --local --dry-<span class="hljs-builtin-name">run</span> -o yaml
</code></pre>
<p>Update ServiceAccount of pod template resources. </p>
<p>Possible resources (case insensitive) can be: </p>
<p>replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset</p>
<h3 id="usage">Usage</h3>
<p><code>$ serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to get from a server. </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set serviceaccount will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-subject-em-"><em>subject</em></h2>
<blockquote class="code-block example">
<p> Update a ClusterRoleBinding for serviceaccount1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> subject clusterrolebinding admin <span class="hljs-attribute">--serviceaccount</span>=namespace:serviceaccount1
</code></pre>
<blockquote class="code-block example">
<p> Update a RoleBinding for user1, user2, and group1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-builtin-name">set</span> subject rolebinding admin <span class="hljs-attribute">--user</span>=user1 <span class="hljs-attribute">--user</span>=user2 <span class="hljs-attribute">--group</span>=group1
</code></pre>
<blockquote class="code-block example">
<p> Print the result (in yaml format) of updating rolebinding subjects from a local, without hitting the server</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl create rolebinding admin <span class="hljs-attribute">--role</span>=admin <span class="hljs-attribute">--user</span>=admin -o yaml --dry-<span class="hljs-builtin-name">run</span> | kubectl <span class="hljs-builtin-name">set</span> subject --local -f - <span class="hljs-attribute">--user</span>=foo -o yaml
</code></pre>
<p>Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.</p>
<h3 id="usage">Usage</h3>
<p><code>$ subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources, including uninitialized ones, in the namespace of the specified resource types </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files the resource to update the subjects </td>
</tr>
<tr>
<td>group</td>
<td></td>
<td>[]</td>
<td>Groups to bind to the role </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>local</td>
<td></td>
<td>false</td>
<td>If true, set subject will NOT contact api-server but run locally. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, not including uninitialized ones, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>serviceaccount</td>
<td></td>
<td>[]</td>
<td>Service accounts to bind to the role </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<h1 id="-strong-declarative-app-management-strong-"><strong>DECLARATIVE APP MANAGEMENT</strong></h1>
<hr>
<h1 id="apply">apply</h1>
<blockquote class="code-block example">
<p> Apply the configuration in pod.json to a pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">apply</span> -f ./pod.json
</code></pre>
<blockquote class="code-block example">
<p> Apply the JSON passed into stdin to a pod.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">cat pod.json | <span class="hljs-type">kubectl</span> <span class="hljs-built_in">apply</span> -f -
</code></pre>
<blockquote class="code-block example">
<p> Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all the other resources that are not in the file and match label app=nginx.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl apply --prune -f manifest.yaml -l <span class="hljs-attribute">app</span>=nginx
</code></pre>
<blockquote class="code-block example">
<p> Apply the configuration in manifest.yaml and delete all the other configmaps that are not in the file.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-comment">kubectl</span> <span class="hljs-comment">apply</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prune</span> <span class="hljs-literal">-</span><span class="hljs-comment">f</span> <span class="hljs-comment">manifest</span><span class="hljs-string">.</span><span class="hljs-comment">yaml</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">all</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prune</span><span class="hljs-literal">-</span><span class="hljs-comment">whitelist=core/v1/ConfigMap</span>
</code></pre>
<p>Apply a configuration to a resource by filename or stdin. The resource name must be specified. This resource will be created if it doesn&#39;t exist yet. To use &#39;apply&#39;, always create the resource initially with either &#39;apply&#39; or &#39;create --save-config&#39;. </p>
<p>JSON and YAML formats are accepted. </p>
<p>Alpha Disclaimer: the --prune functionality is not yet complete. Do not use unless you are aware of what the current state is. See <a href="https://issues.k8s.io/34274">https://issues.k8s.io/34274</a>.</p>
<h3 id="usage">Usage</h3>
<p><code>$ apply -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources in the namespace of the specified resource types. </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>cascade</td>
<td></td>
<td>true</td>
<td>Only relevant during a prune or a force apply. If true, cascade the deletion of the resources managed by pruned or deleted resources (e.g. Pods created by a ReplicationController). </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files that contains the configuration to apply </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Delete and re-create the specified resource, when PATCH encounters conflict and has retried for 5 times. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Only relevant during a prune or a force apply. Period of time in seconds given to pruned or deleted resources to terminate gracefully. Ignored if negative. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>openapi-patch</td>
<td></td>
<td>true</td>
<td>If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>true</td>
<td>Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration </td>
</tr>
<tr>
<td>prune</td>
<td></td>
<td>false</td>
<td>Automatically delete resource objects, including the uninitialized ones, that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all. </td>
</tr>
<tr>
<td>prune-whitelist</td>
<td></td>
<td>[]</td>
<td>Overwrite the default whitelist with <group/version/kind> for --prune </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>Only relevant during a force apply. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-edit-last-applied-em-"><em>edit-last-applied</em></h2>
<blockquote class="code-block example">
<p> Edit the last-applied-configuration annotations by type/name in YAML.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">apply</span> edit-<span class="hljs-built_in">last</span>-applied deployment/nginx
</code></pre>
<blockquote class="code-block example">
<p> Edit the last-applied-configuration annotations by file in JSON.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">apply</span> edit-<span class="hljs-built_in">last</span>-applied -f deploy.yaml -o json
</code></pre>
<p>Edit the latest last-applied-configuration annotations of resources from the default editor. </p>
<p>The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command line tools. It will open the editor defined by your KUBE _EDITOR, or EDITOR environment variables, or fall back to &#39;vi&#39; for Linux or &#39;notepad&#39; for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts filenames as well as command line arguments, although the files you point to must be previously saved versions of resources. </p>
<p>The default format is YAML. To edit in JSON, specify &quot;-o json&quot;. </p>
<p>The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used. </p>
<p>In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.</p>
<h3 id="usage">Usage</h3>
<p><code>$ edit-last-applied (RESOURCE/NAME | -f FILENAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files to use to edit the resource </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td>yaml</td>
<td>Output format. One of: yaml&#124;json. </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>windows-line-endings</td>
<td></td>
<td>false</td>
<td>Defaults to the line ending native to your platform. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-last-applied-em-"><em>set-last-applied</em></h2>
<blockquote class="code-block example">
<p> Set the last-applied-configuration of a resource to match the contents of a file.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">apply </span><span class="hljs-built_in">set-last-applied</span> -f <span class="hljs-string">deploy.</span><span class="hljs-string">yaml</span>
</code></pre>
<blockquote class="code-block example">
<p> Execute set-last-applied against each configuration file in a directory.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">apply </span><span class="hljs-built_in">set-last-applied</span> -f <span class="hljs-string">path/</span>
</code></pre>
<blockquote class="code-block example">
<p> Set the last-applied-configuration of a resource to match the contents of a file, will create the annotation if it does not already exist.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">apply </span><span class="hljs-built_in">set-last-applied</span> -f <span class="hljs-string">deploy.</span><span class="hljs-string">yaml </span><span class="hljs-built_in">--create-annotation=true</span>
</code></pre>
<p>Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though &#39;kubectl apply -f <file>&#39; was run, without updating any other parts of the object.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-last-applied -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>create-annotation</td>
<td></td>
<td>false</td>
<td>Will create &#39;last-applied-configuration&#39; annotations if current objects doesn&#39;t have one </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files that contains the last-applied-configuration annotations </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>record</td>
<td></td>
<td>false</td>
<td>Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-view-last-applied-em-"><em>view-last-applied</em></h2>
<blockquote class="code-block example">
<p> View the last-applied-configuration annotations by type/name in YAML.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">apply</span> <span class="hljs-built_in">view</span>-<span class="hljs-built_in">last</span>-applied deployment/nginx
</code></pre>
<blockquote class="code-block example">
<p> View the last-applied-configuration annotations by file in JSON</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">apply</span> <span class="hljs-built_in">view</span>-<span class="hljs-built_in">last</span>-applied -f deploy.yaml -o json
</code></pre>
<p>View the latest last-applied-configuration annotations by type/name or file. </p>
<p>The default output will be printed to stdout in YAML format. One can use -o option to change output format.</p>
<h3 id="usage">Usage</h3>
<p><code>$ view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all resources in the namespace of the specified resource types </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files that contains the last-applied-configuration annotations </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. Must be one of yaml&#124;json </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
</tbody>
</table>
<h1 id="-strong-working-with-apps-strong-"><strong>WORKING WITH APPS</strong></h1>
<p>This section contains commands for inspecting and debugging your
applications.</p>
<ul>
<li><code>logs</code> will print the logs from the specified pod + container.</li>
<li><code>exec</code> can be used to get an interactive shell on a pod + container.</li>
<li><code>describe</code> will print debug information about the given resource.</li>
</ul>
<hr>
<h1 id="attach">attach</h1>
<blockquote class="code-block example">
<p> Get output from running pod 123456-7890, using the first container by default</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span>
</code></pre>
<blockquote class="code-block example">
<p> Get output from ruby-container from pod 123456-7890</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container
</code></pre>
<blockquote class="code-block example">
<p> Switch to raw terminal mode, sends stdin to &#39;bash&#39; in ruby-container from pod 123456-7890 # and sends stdout/stderr from &#39;bash&#39; back to the client</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-section">attach</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container -i -t
</code></pre>
<blockquote class="code-block example">
<p> Get output from the first pod of a ReplicaSet named nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">attach</span> rs/nginx
</code></pre>
<p>Attach to a process that is already running inside an existing container.</p>
<h3 id="usage">Usage</h3>
<p><code>$ attach (POD | TYPE/NAME) -c CONTAINER</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>1m0s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Pass stdin to the container </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Stdin is a TTY </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="auth">auth</h1>
<p>Inspect authorization</p>
<h3 id="usage">Usage</h3>
<p><code>$ auth</code></p>
<hr>
<h2 id="-em-can-i-em-"><em>can-i</em></h2>
<blockquote class="code-block example">
<p> Check to see if I can create pods in any namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-i <span class="hljs-built_in">create</span> pods <span class="hljs-comment">--all-namespaces</span>
</code></pre>
<blockquote class="code-block example">
<p> Check to see if I can list deployments in my current namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-<span class="hljs-selector-tag">i</span> list deployments.extensions
</code></pre>
<blockquote class="code-block example">
<p> Check to see if I can do everything in my current namespace (&quot;*&quot; means all)</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-<span class="hljs-selector-tag">i</span> <span class="hljs-string">'*'</span> <span class="hljs-string">'*'</span>
</code></pre>
<blockquote class="code-block example">
<p> Check to see if I can get the job named &quot;bar&quot; in namespace &quot;foo&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-<span class="hljs-selector-tag">i</span> list jobs.batch/bar -n foo
</code></pre>
<blockquote class="code-block example">
<p> Check to see if I can read pod logs</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-i <span class="hljs-builtin-name">get</span> pods <span class="hljs-attribute">--subresource</span>=log
</code></pre>
<blockquote class="code-block example">
<p> Check to see if I can access the URL /logs/</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth can-i <span class="hljs-builtin-name">get</span> /logs/
</code></pre>
<p>Check whether an action is allowed. </p>
<p>VERB is a logical Kubernetes API verb like &#39;get&#39;, &#39;list&#39;, &#39;watch&#39;, &#39;delete&#39;, etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL starts with &quot;/&quot;. NAME is the name of a particular Kubernetes resource.</p>
<h3 id="usage">Usage</h3>
<p><code>$ can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If true, check the specified action in all namespaces. </td>
</tr>
<tr>
<td>quiet</td>
<td>q</td>
<td>false</td>
<td>If true, suppress output and just return the exit code. </td>
</tr>
<tr>
<td>subresource</td>
<td></td>
<td></td>
<td>SubResource such as pod/log or deployment/scale </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-reconcile-em-"><em>reconcile</em></h2>
<blockquote class="code-block example">
<p> Reconcile rbac resources from a file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl auth reconcile -f <span class="hljs-keyword">my</span>-rbac-rules.yaml
</code></pre>
<p>Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects. </p>
<p>This is preferred to &#39;apply&#39; for RBAC resources so that proper rule coverage checks are done.</p>
<h3 id="usage">Usage</h3>
<p><code>$ reconcile -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to reconcile. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cp">cp</h1>
<blockquote class="code-block example">
<p> !!!Important Note!!! # Requires that the &#39;tar&#39; binary is present in your container # image.  If &#39;tar&#39; is not present, &#39;kubectl cp&#39; will fail. # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp /tmp/foo_dir &lt;some-pod&gt;<span class="hljs-symbol">:/tmp/bar_dir</span>
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>bar -c <span class="hljs-params">&lt;specific-container&gt;</span>
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace></p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-params">&lt;some-namespace&gt;</span>/<span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>bar
</code></pre>
<blockquote class="code-block example">
<p> Copy /tmp/foo from a remote pod to /tmp/bar locally</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cp <span class="hljs-params">&lt;some-namespace&gt;</span>/<span class="hljs-params">&lt;some-pod&gt;</span>:<span class="hljs-meta-keyword">/tmp/</span>foo <span class="hljs-meta-keyword">/tmp/</span>bar
</code></pre>
<p>Copy files and directories to and from containers.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cp &lt;file-spec-src&gt; &lt;file-spec-dest&gt;</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="describe">describe</h1>
<blockquote class="code-block example">
<p> Describe a node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl describe nodes kubernetes-<span class="hljs-keyword">node</span><span class="hljs-title">-emt8</span>.c.myproject.internal
</code></pre>
<blockquote class="code-block example">
<p> Describe a pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">describe</span> pods/nginx
</code></pre>
<blockquote class="code-block example">
<p> Describe a pod identified by type and name in &quot;pod.json&quot;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">describe</span> <span class="hljs-selector-tag">-f</span> <span class="hljs-selector-tag">pod</span><span class="hljs-selector-class">.json</span>
</code></pre>
<blockquote class="code-block example">
<p> Describe all pods</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl describe pods</span>
</code></pre>
<blockquote class="code-block example">
<p> Describe pods by label name=myLabel</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl describe po -l <span class="hljs-attribute">name</span>=myLabel
</code></pre>
<blockquote class="code-block example">
<p> Describe all pods managed by the &#39;frontend&#39; replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl describe pods frontend</span>
</code></pre>
<p>Show details of a specific resource or group of resources </p>
<p>Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name prefix, or label selector. For example: </p>
<p>  $ kubectl describe TYPE NAME_PREFIX</p>
<p>will first check for an exact match on TYPE and NAME PREFIX. If no such resource exists, it will output details for every resource that has a name prefixed with NAME PREFIX.</p>
<p>Valid resource types include: </p>
<ul>
<li>all  </li>
<li>certificatesigningrequests (aka &#39;csr&#39;)  </li>
<li>clusterrolebindings  </li>
<li>clusterroles  </li>
<li>componentstatuses (aka &#39;cs&#39;)  </li>
<li>configmaps (aka &#39;cm&#39;)  </li>
<li>controllerrevisions  </li>
<li>cronjobs  </li>
<li>customresourcedefinition (aka &#39;crd&#39;)  </li>
<li>daemonsets (aka &#39;ds&#39;)  </li>
<li>deployments (aka &#39;deploy&#39;)  </li>
<li>endpoints (aka &#39;ep&#39;)  </li>
<li>events (aka &#39;ev&#39;)  </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;)  </li>
<li>ingresses (aka &#39;ing&#39;)  </li>
<li>jobs  </li>
<li>limitranges (aka &#39;limits&#39;)  </li>
<li>namespaces (aka &#39;ns&#39;)  </li>
<li>networkpolicies (aka &#39;netpol&#39;)  </li>
<li>nodes (aka &#39;no&#39;)  </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;)  </li>
<li>persistentvolumes (aka &#39;pv&#39;)  </li>
<li>poddisruptionbudgets (aka &#39;pdb&#39;)  </li>
<li>podpreset  </li>
<li>pods (aka &#39;po&#39;)  </li>
<li>podsecuritypolicies (aka &#39;psp&#39;)  </li>
<li>podtemplates  </li>
<li>replicasets (aka &#39;rs&#39;)  </li>
<li>replicationcontrollers (aka &#39;rc&#39;)  </li>
<li>resourcequotas (aka &#39;quota&#39;)  </li>
<li>rolebindings  </li>
<li>roles  </li>
<li>secrets  </li>
<li>serviceaccounts (aka &#39;sa&#39;)  </li>
<li>services (aka &#39;svc&#39;)  </li>
<li>statefulsets (aka &#39;sts&#39;)  </li>
<li>storageclasses (aka &#39;sc&#39;)</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files containing the resource to describe </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>include-uninitialized</td>
<td></td>
<td>false</td>
<td>If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., &quot;--all&quot;. Objects with empty metadata.initializers are regarded as initialized. </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-events</td>
<td></td>
<td>true</td>
<td>If true, display events related to the described object. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="exec">exec</h1>
<blockquote class="code-block example">
<p> Get output from running &#39;date&#39; from pod 123456-7890, using the first container by default</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">exec</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> <span class="hljs-built_in">date</span>
</code></pre>
<blockquote class="code-block example">
<p> Get output from running &#39;date&#39; in ruby-container from pod 123456-7890</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">exec</span> <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-<span class="hljs-keyword">container</span> <span class="hljs-keyword">date</span>
</code></pre>
<blockquote class="code-block example">
<p> Switch to raw terminal mode, sends stdin to &#39;bash&#39; in ruby-container from pod 123456-7890 # and sends stdout/stderr from &#39;bash&#39; back to the client</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl exec <span class="hljs-number">123456</span><span class="hljs-number">-7890</span> -c ruby-container -i -t -- bash -il
</code></pre>
<blockquote class="code-block example">
<p> List contents of /usr from the first container of pod 123456-7890 and sort by modification time. # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (--) to separate your command&#39;s flags/arguments. # Also note, do not surround your command and its flags/arguments with quotes # unless that is how you would execute it normally (i.e., do ls -t /usr, not &quot;ls -t /usr&quot;).</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl exec <span class="hljs-number">123456</span>-<span class="hljs-number">7890</span> -i -<span class="hljs-built_in">t</span> -- ls -<span class="hljs-built_in">t</span> /usr
</code></pre>
<p>Execute a command in a container.</p>
<h3 id="usage">Usage</h3>
<p><code>$ exec POD [-c CONTAINER] -- COMMAND [args...]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Container name. If omitted, the first container in the pod will be chosen </td>
</tr>
<tr>
<td>pod</td>
<td>p</td>
<td></td>
<td>Pod name </td>
</tr>
<tr>
<td>stdin</td>
<td>i</td>
<td>false</td>
<td>Pass stdin to the container </td>
</tr>
<tr>
<td>tty</td>
<td>t</td>
<td>false</td>
<td>Stdin is a TTY </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="logs">logs</h1>
<blockquote class="code-block example">
<p> Return snapshot logs from pod nginx with only one container</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl logs nginx</span>
</code></pre>
<blockquote class="code-block example">
<p> Return snapshot logs for the pods defined by label app=nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-attribute">-lapp</span>=nginx
</code></pre>
<blockquote class="code-block example">
<p> Return snapshot of previous terminated ruby container logs from pod web-1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs -<span class="hljs-selector-tag">p</span> -c ruby web-<span class="hljs-number">1</span>
</code></pre>
<blockquote class="code-block example">
<p> Begin streaming the logs of the ruby container in pod web-1</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs -f -<span class="hljs-keyword">c</span> ruby web<span class="hljs-number">-1</span>
</code></pre>
<blockquote class="code-block example">
<p> Display only the most recent 20 lines of output in pod nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-attribute">--tail</span>=20 nginx
</code></pre>
<blockquote class="code-block example">
<p> Show all logs from pod nginx written in the last hour</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-attribute">--since</span>=1h nginx
</code></pre>
<blockquote class="code-block example">
<p> Return snapshot logs from first container of a job named hello</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs <span class="hljs-keyword">job</span>/hello
</code></pre>
<blockquote class="code-block example">
<p> Return snapshot logs from container nginx-1 of a deployment named nginx</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl logs deployment/nginx -<span class="hljs-keyword">c</span> nginx<span class="hljs-number">-1</span>
</code></pre>
<p>Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.</p>
<h3 id="usage">Usage</h3>
<p><code>$ logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>container</td>
<td>c</td>
<td></td>
<td>Print the logs of this container </td>
</tr>
<tr>
<td>follow</td>
<td>f</td>
<td>false</td>
<td>Specify if the logs should be streamed. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>interactive</td>
<td></td>
<td>false</td>
<td>If true, prompt the user for input when required. </td>
</tr>
<tr>
<td>limit-bytes</td>
<td></td>
<td>0</td>
<td>Maximum bytes of logs to return. Defaults to no limit. </td>
</tr>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>20s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
<tr>
<td>previous</td>
<td>p</td>
<td>false</td>
<td>If true, print the logs for the previous instance of the container in a pod if it exists. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on. </td>
</tr>
<tr>
<td>since</td>
<td></td>
<td>0s</td>
<td>Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used. </td>
</tr>
<tr>
<td>since-time</td>
<td></td>
<td></td>
<td>Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used. </td>
</tr>
<tr>
<td>tail</td>
<td></td>
<td>-1</td>
<td>Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is provided. </td>
</tr>
<tr>
<td>timestamps</td>
<td></td>
<td>false</td>
<td>Include timestamps on each line in the log output </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="port-forward">port-forward</h1>
<blockquote class="code-block example">
<p> Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl port-forward pod/mypod <span class="hljs-number">5000</span> <span class="hljs-number">6000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl port-forward deployment/mydeployment <span class="hljs-number">5000</span> <span class="hljs-number">6000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on port 8888 locally, forwarding to 5000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl port-<span class="hljs-keyword">forward</span> pod/mypod <span class="hljs-number">8888</span>:<span class="hljs-number">5000</span>
</code></pre>
<blockquote class="code-block example">
<p> Listen on a random port locally, forwarding to 5000 in the pod</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl port-<span class="hljs-keyword">forward</span> pod/mypod :<span class="hljs-number">5000</span>
</code></pre>
<p>Forward one or more local ports to a pod. </p>
<p>Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to &#39;pod&#39; if omitted. </p>
<p>If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and rerun of the command is needed to resume forwarding.</p>
<h3 id="usage">Usage</h3>
<p><code>$ port-forward TYPE/NAME [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>1m0s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="proxy">proxy</h1>
<blockquote class="code-block example">
<p> To proxy all of the kubernetes api and nothing else, use:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--api-prefix</span>=/
</code></pre>
<blockquote class="code-block example">
<p> To proxy only part of the kubernetes api and also some static files:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--www</span>=/my/files <span class="hljs-attribute">--www-prefix</span>=/static/ <span class="hljs-attribute">--api-prefix</span>=/api/
</code></pre>
<blockquote class="code-block example">
<p> The above lets you &#39;curl localhost:8001/api/v1/pods&#39;. # To proxy the entire kubernetes api at a different root, use:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--api-prefix</span>=/custom/
</code></pre>
<blockquote class="code-block example">
<p> The above lets you &#39;curl localhost:8001/custom/api/v1/pods&#39; # Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--port</span>=8011 <span class="hljs-attribute">--www</span>=./local/www/
</code></pre>
<blockquote class="code-block example">
<p> Run a proxy to kubernetes apiserver on an arbitrary local port. # The chosen port for the server will be output to stdout.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--port</span>=0
</code></pre>
<blockquote class="code-block example">
<p> Run a proxy to kubernetes apiserver, changing the api prefix to k8s-api # This makes e.g. the pods api available at localhost:8001/k8s-api/v1/pods/</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> proxy </span><span class="hljs-attribute">--api-prefix</span>=/k8s-api
</code></pre>
<p>Creates a proxy server or application-level gateway between localhost and the Kubernetes API Server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote kubernetes API Server port, except for the path matching the static content path.</p>
<h3 id="usage">Usage</h3>
<p><code>$ proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>accept-hosts</td>
<td></td>
<td>^localhost$,^127.0.0.1$,^[::1]$</td>
<td>Regular expression for hosts that the proxy should accept. </td>
</tr>
<tr>
<td>accept-paths</td>
<td></td>
<td>^.*</td>
<td>Regular expression for paths that the proxy should accept. </td>
</tr>
<tr>
<td>address</td>
<td></td>
<td>127.0.0.1</td>
<td>The IP address on which to serve on. </td>
</tr>
<tr>
<td>api-prefix</td>
<td></td>
<td>/</td>
<td>Prefix to serve the proxied API under. </td>
</tr>
<tr>
<td>disable-filter</td>
<td></td>
<td>false</td>
<td>If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port. </td>
</tr>
<tr>
<td>port</td>
<td>p</td>
<td>8001</td>
<td>The port on which to run the proxy. Set to 0 to pick a random port. </td>
</tr>
<tr>
<td>reject-methods</td>
<td></td>
<td>^$</td>
<td>Regular expression for HTTP methods that the proxy should reject (example --reject-methods=&#39;POST,PUT,PATCH&#39;).  </td>
</tr>
<tr>
<td>reject-paths</td>
<td></td>
<td>^/api/.<em>/pods/.</em>/exec,^/api/.<em>/pods/.</em>/attach</td>
<td>Regular expression for paths that the proxy should reject. Paths specified here will be rejected even accepted by --accept-paths. </td>
</tr>
<tr>
<td>unix-socket</td>
<td>u</td>
<td></td>
<td>Unix socket on which to run the proxy. </td>
</tr>
<tr>
<td>www</td>
<td>w</td>
<td></td>
<td>Also serve static files from the given directory under the specified prefix. </td>
</tr>
<tr>
<td>www-prefix</td>
<td>P</td>
<td>/static/</td>
<td>Prefix to serve static files under, if static file directory is specified. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="top">top</h1>
<p>Display Resource (CPU/Memory/Storage) usage. </p>
<p>The top command allows you to see the resource consumption for nodes or pods. </p>
<p>This command requires Heapster to be correctly configured and working on the server.</p>
<h3 id="usage">Usage</h3>
<p><code>$ top</code></p>
<hr>
<h2 id="-em-node-em-"><em>node</em></h2>
<blockquote class="code-block example">
<p> Show metrics for all nodes</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top <span class="hljs-keyword">node</span><span class="hljs-title"></span>
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for a given node</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top <span class="hljs-keyword">node</span> <span class="hljs-title">NODE_NAME</span>
</code></pre>
<p>Display Resource (CPU/Memory/Storage) usage of nodes. </p>
<p>The top-node command allows you to see the resource consumption of nodes.</p>
<h3 id="usage">Usage</h3>
<p><code>$ node [NAME | -l label]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>heapster-namespace</td>
<td></td>
<td>kube-system</td>
<td>Namespace Heapster service is located in </td>
</tr>
<tr>
<td>heapster-port</td>
<td></td>
<td></td>
<td>Port name in service to use </td>
</tr>
<tr>
<td>heapster-scheme</td>
<td></td>
<td>http</td>
<td>Scheme (http or https) to connect to Heapster as </td>
</tr>
<tr>
<td>heapster-service</td>
<td></td>
<td>heapster</td>
<td>Name of Heapster service </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-pod-em-"><em>pod</em></h2>
<blockquote class="code-block example">
<p> Show metrics for all pods in the default namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">top</span> pod
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for all pods in the given namespace</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod --<span class="hljs-keyword">namespace</span>=NAMESPACE
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for a given pod and its containers</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod POD_NAME <span class="hljs-comment">--containers</span>
</code></pre>
<blockquote class="code-block example">
<p> Show metrics for the pods defined by label name=myLabel</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl top pod -l <span class="hljs-attribute">name</span>=myLabel
</code></pre>
<p>Display Resource (CPU/Memory/Storage) usage of pods. </p>
<p>The &#39;top pod&#39; command allows you to see the resource consumption of pods. </p>
<p>Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.</p>
<h3 id="usage">Usage</h3>
<p><code>$ pod [NAME | -l label]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. </td>
</tr>
<tr>
<td>containers</td>
<td></td>
<td>false</td>
<td>If present, print usage of containers within a pod. </td>
</tr>
<tr>
<td>heapster-namespace</td>
<td></td>
<td>kube-system</td>
<td>Namespace Heapster service is located in </td>
</tr>
<tr>
<td>heapster-port</td>
<td></td>
<td></td>
<td>Port name in service to use </td>
</tr>
<tr>
<td>heapster-scheme</td>
<td></td>
<td>http</td>
<td>Scheme (http or https) to connect to Heapster as </td>
</tr>
<tr>
<td>heapster-service</td>
<td></td>
<td>heapster</td>
<td>Name of Heapster service </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
</tbody>
</table>
<h1 id="-strong-cluster-management-strong-"><strong>CLUSTER MANAGEMENT</strong></h1>
<hr>
<h1 id="api-versions">api-versions</h1>
<blockquote class="code-block example">
<p> Print the supported API versions</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl api-versions</span>
</code></pre>
<p>Print the supported API versions on the server, in the form of &quot;group/version&quot;</p>
<h3 id="usage">Usage</h3>
<p><code>$ api-versions</code></p>
<hr>
<h1 id="certificate">certificate</h1>
<p>Modify certificate resources.</p>
<h3 id="usage">Usage</h3>
<p><code>$ certificate SUBCOMMAND</code></p>
<hr>
<h2 id="-em-approve-em-"><em>approve</em></h2>
<p>Approve a certificate signing request. </p>
<p>kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attributes requested in the CSR. </p>
<p>SECURITY NOTICE: Depending on the requested attributes, the issued certificate can potentially grant a requester access to cluster resources or to authenticate as a requested identity. Before approving a CSR, ensure you understand what the signed certificate can do.</p>
<h3 id="usage">Usage</h3>
<p><code>$ approve (-f FILENAME | NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-deny-em-"><em>deny</em></h2>
<p>Deny a certificate signing request. </p>
<p>kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.</p>
<h3 id="usage">Usage</h3>
<p><code>$ deny (-f FILENAME | NAME)</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files identifying the resource to update </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output mode. Use &quot;-o name&quot; for shorter output (resource/name). </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cluster-info">cluster-info</h1>
<blockquote class="code-block example">
<p> Print the address of the master and cluster services</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> cluster-<span class="hljs-literal">info</span>
</code></pre>
<p>Display addresses of the master and services with label kubernetes.io/cluster-service=true To further debug and diagnose cluster problems, use &#39;kubectl cluster-info dump&#39;.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cluster-info</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-dump-em-"><em>dump</em></h2>
<blockquote class="code-block example">
<p> Dump current cluster state to stdout</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> cluster-<span class="hljs-literal">info</span> dump
</code></pre>
<blockquote class="code-block example">
<p> Dump current cluster state to /path/to/cluster-state</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cluster-<span class="hljs-builtin-name">info</span> dump <span class="hljs-attribute">--output-directory</span>=/path/to/cluster-state
</code></pre>
<blockquote class="code-block example">
<p> Dump all namespaces to stdout</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl cluster-info <span class="hljs-built_in">dump</span> <span class="hljs-comment">--all-namespaces</span>
</code></pre>
<blockquote class="code-block example">
<p> Dump a set of namespaces to /path/to/cluster-state</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-keyword">cluster</span>-info dump --namespaces <span class="hljs-keyword">default</span>,kube-<span class="hljs-keyword">system</span> --output-directory=/path/to/<span class="hljs-keyword">cluster</span>-state
</code></pre>
<p>Dumps cluster info out suitable for debugging and diagnosing cluster problems.  By default, dumps everything to stdout. You can optionally specify a directory with --output-directory.  If you specify a directory, kubernetes will build a set of files in that directory.  By default only dumps things in the &#39;kube-system&#39; namespace, but you can switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces. </p>
<p>The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories based on namespace and pod name.</p>
<h3 id="usage">Usage</h3>
<p><code>$ dump</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all-namespaces</td>
<td></td>
<td>false</td>
<td>If true, dump all namespaces.  If true, --namespaces is ignored. </td>
</tr>
<tr>
<td>namespaces</td>
<td></td>
<td>[]</td>
<td>A comma separated list of namespaces to dump. </td>
</tr>
<tr>
<td>output-directory</td>
<td></td>
<td></td>
<td>Where to output the files.  If empty or &#39;-&#39; uses stdout, otherwise creates a directory hierarchy in that directory </td>
</tr>
<tr>
<td>pod-running-timeout</td>
<td></td>
<td>20s</td>
<td>The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="cordon">cordon</h1>
<blockquote class="code-block example">
<p> Mark node &quot;foo&quot; as unschedulable.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl cordon foo</span>
</code></pre>
<p>Mark node as unschedulable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ cordon NODE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="drain">drain</h1>
<blockquote class="code-block example">
<p> Drain node &quot;foo&quot;, even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet on it.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-meta">$</span><span class="bash"> kubectl drain foo --force</span>
</code></pre>
<blockquote class="code-block example">
<p> As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, and use a grace period of 15 minutes.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">$ kubectl drain foo <span class="hljs-attribute">--grace-period</span>=900
</code></pre>
<p>Drain node in preparation for maintenance. </p>
<p>The given node will be marked unschedulable to prevent new pods from arriving. &#39;drain&#39; evicts the pods if the APIServer supports eviction (<a href="http://kubernetes.io/docs/admin/disruptions/">http://kubernetes.io/docs/admin/disruptions/</a>). Otherwise, it will use normal DELETE to delete the pods. The &#39;drain&#39; evicts or deletes all pods except mirror pods (which cannot be deleted through the API server).  If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings.  If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then drain will not delete any pods unless you use --force.  --force will also allow deletion to proceed if the managing resource of one or more pods is missing. </p>
<p>&#39;drain&#39; waits for graceful termination. You should not operate on the machine until the command completes. </p>
<p>When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again. </p>
<p>! <a href="http://kubernetes.io/images/docs/kubectl_drain.svg">http://kubernetes.io/images/docs/kubectl_drain.svg</a></p>
<h3 id="usage">Usage</h3>
<p><code>$ drain NODE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>delete-local-data</td>
<td></td>
<td>false</td>
<td>Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained). </td>
</tr>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>force</td>
<td></td>
<td>false</td>
<td>Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet. </td>
</tr>
<tr>
<td>grace-period</td>
<td></td>
<td>-1</td>
<td>Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used. </td>
</tr>
<tr>
<td>ignore-daemonsets</td>
<td></td>
<td>false</td>
<td>Ignore DaemonSet-managed pods. </td>
</tr>
<tr>
<td>pod-selector</td>
<td></td>
<td></td>
<td>Label selector to filter pods on the node </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
<tr>
<td>timeout</td>
<td></td>
<td>0s</td>
<td>The length of time to wait before giving up, zero means infinite </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="taint">taint</h1>
<blockquote class="code-block example">
<p> Update node &#39;foo&#39; with a taint with key &#39;dedicated&#39; and value &#39;special-user&#39; and effect &#39;NoSchedule&#39;. # If a taint with that key and effect already exists, its value is replaced as specified.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl taint nodes foo <span class="hljs-attribute">dedicated</span>=special-user:NoSchedule
</code></pre>
<blockquote class="code-block example">
<p> Remove from node &#39;foo&#39; the taint with key &#39;dedicated&#39; and effect &#39;NoSchedule&#39; if one exists.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">taint</span> <span class="hljs-selector-tag">nodes</span> <span class="hljs-selector-tag">foo</span> <span class="hljs-selector-tag">dedicated</span><span class="hljs-selector-pseudo">:NoSchedule-</span>
</code></pre>
<blockquote class="code-block example">
<p> Remove from node &#39;foo&#39; all the taints with key &#39;dedicated&#39;</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> taint nodes foo dedicated-
</code></pre>
<blockquote class="code-block example">
<p> Add a taint with key &#39;dedicated&#39; on nodes having label mylabel=X</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl taint <span class="hljs-keyword">node</span> <span class="hljs-title">-l</span> <span class="hljs-attr">myLabel=</span>X  <span class="hljs-attr">dedicated=</span>foo:PreferNoSchedule
</code></pre>
<p>Update the taints on one or more nodes. </p>
<ul>
<li>A taint consists of a key, value, and effect. As an argument here, it is expressed as key=value:effect.  </li>
<li>The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to  253 characters.  </li>
<li>Optionally, the key can begin with a DNS subdomain prefix and a single &#39;/&#39;, like example.com/my-app  </li>
<li>The value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to  63 characters.  </li>
<li>The effect must be NoSchedule, PreferNoSchedule or NoExecute.  </li>
<li>Currently taint can only apply to node.</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>all</td>
<td></td>
<td>false</td>
<td>Select all nodes in the cluster </td>
</tr>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>overwrite</td>
<td></td>
<td>false</td>
<td>If true, allow taints to be overwritten, otherwise reject taint updates that overwrite existing taints. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on, supports &#39;=&#39;, &#39;==&#39;, and &#39;!=&#39;.(e.g. -l key1=value1,key2=value2) </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
<tr>
<td>validate</td>
<td></td>
<td>true</td>
<td>If true, use a schema to validate the input before sending it </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="uncordon">uncordon</h1>
<blockquote class="code-block example">
<p> Mark node &quot;foo&quot; as schedulable.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-meta">$</span><span class="bash"> kubectl uncordon foo</span>
</code></pre>
<p>Mark node as schedulable.</p>
<h3 id="usage">Usage</h3>
<p><code>$ uncordon NODE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>dry-run</td>
<td></td>
<td>false</td>
<td>If true, only print the object that would be sent, without sending it. </td>
</tr>
<tr>
<td>selector</td>
<td>l</td>
<td></td>
<td>Selector (label query) to filter on </td>
</tr>
</tbody>
</table>
<h1 id="-strong-kubectl-settings-and-usage-strong-"><strong>KUBECTL SETTINGS AND USAGE</strong></h1>
<hr>
<h1 id="alpha">alpha</h1>
<p>These commands correspond to alpha features that are not enabled in Kubernetes clusters by default.</p>
<h3 id="usage">Usage</h3>
<p><code>$ alpha</code></p>
<hr>
<h2 id="-em-diff-em-"><em>diff</em></h2>
<blockquote class="code-block example">
<p> Diff resources included in pod.json. By default, it will diff LOCAL and LIVE versions</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-selector-tag">kubectl</span> <span class="hljs-selector-tag">alpha</span> <span class="hljs-selector-tag">diff</span> <span class="hljs-selector-tag">-f</span> <span class="hljs-selector-tag">pod</span><span class="hljs-selector-class">.json</span>
</code></pre>
<blockquote class="code-block example">
<p> When one version is specified, diff that version against LIVE</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">cat</span> service.yaml | kubectl <span class="hljs-keyword">alpha</span> diff -f - MERGED
</code></pre>
<blockquote class="code-block example">
<p> Or specify both versions</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl alpha diff -f pod<span class="hljs-selector-class">.json</span> -f service<span class="hljs-selector-class">.yaml</span> LAST LOCAL
</code></pre>
<p>Diff configurations specified by filename or stdin between their local, last-applied, live and/or &quot;merged&quot; versions. </p>
<p>LOCAL and LIVE versions are diffed by default. Other available keywords are MERGED and LAST. </p>
<p>Output is always YAML. </p>
<p>KUBERNETES EXTERNAL DIFF environment variable can be used to select your own diff command. By default, the &quot;diff&quot; command available in your path will be run with &quot;-u&quot; (unicode) and &quot;-N&quot; (treat new files as empty) options.</p>
<h3 id="usage">Usage</h3>
<p><code>$ diff -f FILENAME</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>f</td>
<td>[]</td>
<td>Filename, directory, or URL to files contains the configuration to diff </td>
</tr>
<tr>
<td>recursive</td>
<td>R</td>
<td>false</td>
<td>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="completion">completion</h1>
<blockquote class="code-block example">
<p> Installing bash completion on macOS using homebrew ## If running Bash 3.2 included with macOS</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">brew </span><span class="hljs-keyword">install </span><span class="hljs-keyword">bash-completion</span>
</code></pre>
<blockquote class="code-block example#">
<p> or, if running Bash 4.1+</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-keyword">brew </span><span class="hljs-keyword">install </span><span class="hljs-keyword">bash-completion@2</span>
</code></pre>
<blockquote class="code-block example#">
<p> If kubectl is installed via homebrew, this should start working immediately. ## If you&#39;ve installed via other means, you may need add the completion to your completion directory</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-symbol">kubectl</span> completion <span class="hljs-keyword">bash </span>&gt; $(<span class="hljs-keyword">brew </span>--prefix)/etc/<span class="hljs-keyword">bash_completion.d/kubectl</span>
</code></pre>
<blockquote class="code-block example">
<p> Installing bash completion on Linux ## Load the kubectl completion code for bash into the current shell</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">source &lt;(<span class="hljs-name">kubectl</span> completion bash)
</code></pre>
<blockquote class="code-block example#">
<p> Write bash completion code to a file and source if from .bash_profile</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl completion bash &gt; ~/.kube/completion<span class="hljs-selector-class">.bash</span><span class="hljs-selector-class">.inc</span>
printf <span class="hljs-string">"</span>
</code></pre>
<blockquote class="code-block example">
<p> Kubectl shell completion</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">source</span> <span class="hljs-string">'<span class="hljs-variable">$HOME</span>/.kube/completion.bash.inc'</span>
<span class="hljs-string">" &gt;&gt; <span class="hljs-variable">$HOME</span>/.bash_profile
source <span class="hljs-variable">$HOME</span>/.bash_profile</span>
</code></pre>
<blockquote class="code-block example">
<p> Load the kubectl completion code for zsh[1] into the current shell</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">source &lt;(<span class="hljs-name">kubectl</span> completion zsh)
</code></pre>
<blockquote class="code-block example">
<p> Set the kubectl completion code for zsh[1] to autoload on startup</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl</span> completion zsh &gt; <span class="hljs-string">"<span class="hljs-variable">${fpath[1]}</span>/_kubectl"</span>
</code></pre>
<p>Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands.  This can be done by sourcing it from the .bash _profile. </p>
<p>Detailed instructions on how to do this are available here: <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion">https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion</a> </p>
<p>Note for zsh users: [1] zsh completions are only supported in versions of zsh &gt;= 5.2</p>
<h3 id="usage">Usage</h3>
<p><code>$ completion SHELL</code></p>
<hr>
<h1 id="config">config</h1>
<p>Modify kubeconfig files using subcommands like &quot;kubectl config set current-context my-context&quot; </p>
<p>The loading order follows these rules: </p>
<ol>
<li>If the --kubeconfig flag is set, then only that file is loaded.  The flag may only be set once and no merging takes place.  </li>
<li>If $KUBECONFIG environment variable is set, then it is used a list of paths (normal path delimitting rules for your system).  These paths are merged.  When a value is modified, it is modified in the file that defines the stanza.  When a value is created, it is created in the first file that exists.  If no files in the chain exist, then it creates the last file in the list.  </li>
<li>Otherwise, ${HOME}/.kube/config is used and no merging takes place.</li>
</ol>
<h3 id="usage">Usage</h3>
<p><code>$ config SUBCOMMAND</code></p>
<hr>
<h2 id="-em-current-context-em-"><em>current-context</em></h2>
<blockquote class="code-block example">
<p> Display the current-context</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>current-context
</code></pre>
<p>Displays the current-context</p>
<h3 id="usage">Usage</h3>
<p><code>$ current-context</code></p>
<hr>
<h2 id="-em-delete-cluster-em-"><em>delete-cluster</em></h2>
<blockquote class="code-block example">
<p> Delete the minikube cluster</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">delete-cluster</span> <span class="hljs-string">minikube</span>
</code></pre>
<p>Delete the specified cluster from the kubeconfig</p>
<h3 id="usage">Usage</h3>
<p><code>$ delete-cluster NAME</code></p>
<hr>
<h2 id="-em-delete-context-em-"><em>delete-context</em></h2>
<blockquote class="code-block example">
<p> Delete the context for the minikube cluster</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">delete-context</span> <span class="hljs-string">minikube</span>
</code></pre>
<p>Delete the specified context from the kubeconfig</p>
<h3 id="usage">Usage</h3>
<p><code>$ delete-context NAME</code></p>
<hr>
<h2 id="-em-get-clusters-em-"><em>get-clusters</em></h2>
<blockquote class="code-block example">
<p> List the clusters kubectl knows about</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>get-clusters
</code></pre>
<p>Display clusters defined in the kubeconfig.</p>
<h3 id="usage">Usage</h3>
<p><code>$ get-clusters</code></p>
<hr>
<h2 id="-em-get-contexts-em-"><em>get-contexts</em></h2>
<blockquote class="code-block example">
<p> List all the contexts in your kubeconfig file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>get-contexts
</code></pre>
<blockquote class="code-block example">
<p> Describe one context in your kubeconfig file.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-string">kubectl </span><span class="hljs-string">config </span><span class="hljs-built_in">get-contexts</span> <span class="hljs-string">my-context</span>
</code></pre>
<p>Displays one or many contexts from the kubeconfig file.</p>
<h3 id="usage">Usage</h3>
<p><code>$ get-contexts [(-o|--output=)name)]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-rename-context-em-"><em>rename-context</em></h2>
<blockquote class="code-block example">
<p> Rename the context &#39;old-name&#39; to &#39;new-name&#39; in your kubeconfig file</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>rename-context old-name new-name
</code></pre>
<p>Renames a context from the kubeconfig file. </p>
<p>CONTEXT _NAME is the context name that you wish change. </p>
<p>NEW _NAME is the new name you wish to set. </p>
<p>Note: In case the context being renamed is the &#39;current-context&#39;, this field will also be updated.</p>
<h3 id="usage">Usage</h3>
<p><code>$ rename-context CONTEXT_NAME NEW_NAME</code></p>
<hr>
<h2 id="-em-set-em-"><em>set</em></h2>
<p>Sets an individual value in a kubeconfig file </p>
<p>PROPERTY _NAME is a dot delimited name where each token represents either an attribute name or a map key.  Map keys may not contain dots. </p>
<p>PROPERTY _VALUE is the new value you wish to set. Binary fields such as &#39;certificate-authority-data&#39; expect a base64 encoded string unless the --set-raw-bytes flag is used.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set PROPERTY_NAME PROPERTY_VALUE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>set-raw-bytes</td>
<td></td>
<td>false</td>
<td>When writing a []byte PROPERTY_VALUE, write the given string directly without base64 decoding. </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-cluster-em-"><em>set-cluster</em></h2>
<blockquote class="code-block example">
<p> Set only the server field on the e2e cluster entry without touching other values.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-cluster e2e <span class="hljs-attribute">--server</span>=https://1.2.3.4
</code></pre>
<blockquote class="code-block example">
<p> Embed certificate authority data for the e2e cluster entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-cluster e2e <span class="hljs-attribute">--certificate-authority</span>=~/.kube/e2e/kubernetes.ca.crt
</code></pre>
<blockquote class="code-block example">
<p> Disable cert checking for the dev cluster entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-cluster e2e <span class="hljs-attribute">--insecure-skip-tls-verify</span>=<span class="hljs-literal">true</span>
</code></pre>
<p>Sets a cluster entry in kubeconfig. </p>
<p>Specifying a name that already exists will merge new fields on top of existing values for those fields.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>embed-certs</td>
<td></td>
<td>false</td>
<td>embed-certs for the cluster entry in kubeconfig </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-set-context-em-"><em>set-context</em></h2>
<blockquote class="code-block example">
<p> Set the user field on the gce context entry without touching other values</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-context gce <span class="hljs-attribute">--user</span>=cluster-admin
</code></pre>
<p>Sets a context entry in kubeconfig </p>
<p>Specifying a name that already exists will merge new fields on top of existing values for those fields.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-context NAME [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]</code></p>
<hr>
<h2 id="-em-set-credentials-em-"><em>set-credentials</em></h2>
<blockquote class="code-block example">
<p> Set only the &quot;client-key&quot; field on the &quot;cluster-admin&quot; # entry, without touching other values:</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--client-key</span>=~/.kube/admin.key
</code></pre>
<blockquote class="code-block example">
<p> Set basic auth for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--username</span>=admin <span class="hljs-attribute">--password</span>=uXFGweU9l35qcif
</code></pre>
<blockquote class="code-block example">
<p> Embed client certificate data in the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--client-certificate</span>=~/.kube/admin.crt <span class="hljs-attribute">--embed-certs</span>=<span class="hljs-literal">true</span>
</code></pre>
<blockquote class="code-block example">
<p> Enable the Google Compute Platform auth provider for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--auth-provider</span>=gcp
</code></pre>
<blockquote class="code-block example">
<p> Enable the OpenID Connect auth provider for the &quot;cluster-admin&quot; entry with additional args</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--auth-provider</span>=oidc <span class="hljs-attribute">--auth-provider-arg</span>=client-id=foo <span class="hljs-attribute">--auth-provider-arg</span>=client-secret=bar
</code></pre>
<blockquote class="code-block example">
<p> Remove the &quot;client-secret&quot; config value for the OpenID Connect auth provider for the &quot;cluster-admin&quot; entry</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>set-credentials cluster-admin <span class="hljs-attribute">--auth-provider</span>=oidc <span class="hljs-attribute">--auth-provider-arg</span>=client-secret-
</code></pre>
<p>Sets a user entry in kubeconfig </p>
<p>Specifying a name that already exists will merge new fields on top of existing values. </p>
<p>  Client-certificate flags:
  --client-certificate=certfile --client-key=keyfile</p>
<p>  Bearer token flags:
    --token=bearer_token</p>
<p>  Basic auth flags:
    --username=basic_user --password=basic_password</p>
<p>Bearer token and basic auth are mutually exclusive.</p>
<h3 id="usage">Usage</h3>
<p><code>$ set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value]</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>auth-provider</td>
<td></td>
<td></td>
<td>Auth provider for the user entry in kubeconfig </td>
</tr>
<tr>
<td>auth-provider-arg</td>
<td></td>
<td>[]</td>
<td>&#39;key=value&#39; arguments for the auth provider </td>
</tr>
<tr>
<td>embed-certs</td>
<td></td>
<td>false</td>
<td>Embed client cert/key for the user entry in kubeconfig </td>
</tr>
</tbody>
</table>
<hr>
<h2 id="-em-unset-em-"><em>unset</em></h2>
<blockquote class="code-block example">
<p> Unset the current-context.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>unset current-context
</code></pre>
<blockquote class="code-block example">
<p> Unset namespace in foo context.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>unset contexts.foo.namespace
</code></pre>
<p>Unsets an individual value in a kubeconfig file </p>
<p>PROPERTY _NAME is a dot delimited name where each token represents either an attribute name or a map key.  Map keys may not contain dots.</p>
<h3 id="usage">Usage</h3>
<p><code>$ unset PROPERTY_NAME</code></p>
<hr>
<h2 id="-em-use-context-em-"><em>use-context</em></h2>
<blockquote class="code-block example">
<p> Use the context for the minikube cluster</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>use-context minikube
</code></pre>
<p>Sets the current-context in a kubeconfig file</p>
<h3 id="usage">Usage</h3>
<p><code>$ use-context CONTEXT_NAME</code></p>
<hr>
<h2 id="-em-view-em-"><em>view</em></h2>
<blockquote class="code-block example">
<p> Show Merged kubeconfig settings.</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>view
</code></pre>
<blockquote class="code-block example">
<p> Get the password for the e2e user</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl<span class="hljs-built_in"> config </span>view -o <span class="hljs-attribute">jsonpath</span>=<span class="hljs-string">'{.users[?(@.name == "e2e")].user.password}'</span>
</code></pre>
<p>Display merged kubeconfig settings or a specified kubeconfig file. </p>
<p>You can use --output jsonpath={...} to extract specific values using a jsonpath expression.</p>
<h3 id="usage">Usage</h3>
<p><code>$ view</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>allow-missing-template-keys</td>
<td></td>
<td>true</td>
<td>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. </td>
</tr>
<tr>
<td>flatten</td>
<td></td>
<td>false</td>
<td>Flatten the resulting kubeconfig file into self-contained output (useful for creating portable kubeconfig files) </td>
</tr>
<tr>
<td>merge</td>
<td></td>
<td>true</td>
<td>Merge the full hierarchy of kubeconfig files </td>
</tr>
<tr>
<td>minify</td>
<td></td>
<td>false</td>
<td>Remove all information not used by current-context from the output </td>
</tr>
<tr>
<td>no-headers</td>
<td></td>
<td>false</td>
<td>When using the default or custom-column output format, don&#39;t print headers (default print headers). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>Output format. One of: json&#124;yaml&#124;wide&#124;name&#124;custom-columns=...&#124;custom-columns-file=...&#124;go-template=...&#124;go-template-file=...&#124;jsonpath=...&#124;jsonpath-file=... See custom columns [<a href="http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns">http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns</a>], golang template [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>] and jsonpath template [<a href="http://kubernetes.io/docs/user-guide/jsonpath">http://kubernetes.io/docs/user-guide/jsonpath</a>]. </td>
</tr>
<tr>
<td>output-version</td>
<td></td>
<td></td>
<td>DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: &#39;jobs.v1.batch/myjob&#39;). </td>
</tr>
<tr>
<td>raw</td>
<td></td>
<td>false</td>
<td>Display raw byte data </td>
</tr>
<tr>
<td>show-all</td>
<td>a</td>
<td>true</td>
<td>When printing, show all resources (default show all pods including terminated one.) </td>
</tr>
<tr>
<td>show-labels</td>
<td></td>
<td>false</td>
<td>When printing, show all labels as the last column (default hide labels column) </td>
</tr>
<tr>
<td>sort-by</td>
<td></td>
<td></td>
<td>If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. &#39;{.metadata.name}&#39;). The field in the API resource specified by this JSONPath expression must be an integer or a string. </td>
</tr>
<tr>
<td>template</td>
<td></td>
<td></td>
<td>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [<a href="http://golang.org/pkg/text/template/#pkg-overview">http://golang.org/pkg/text/template/#pkg-overview</a>]. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="explain">explain</h1>
<blockquote class="code-block example">
<p> Get the documentation of the resource and its fields</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl explain pods</span>
</code></pre>
<blockquote class="code-block example">
<p> Get the documentation of a specific field of a resource</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl explain pods<span class="hljs-selector-class">.spec</span><span class="hljs-selector-class">.containers</span>
</code></pre>
<p>List the fields for supported resources </p>
<p>This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier: </p>
<p>  <type>.<fieldName>[.<fieldName>]</p>
<p>Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is retrieved from the server in OpenAPI format.</p>
<p>Valid resource types include: </p>
<ul>
<li>all  </li>
<li>certificatesigningrequests (aka &#39;csr&#39;)  </li>
<li>clusterrolebindings  </li>
<li>clusterroles  </li>
<li>componentstatuses (aka &#39;cs&#39;)  </li>
<li>configmaps (aka &#39;cm&#39;)  </li>
<li>controllerrevisions  </li>
<li>cronjobs  </li>
<li>customresourcedefinition (aka &#39;crd&#39;)  </li>
<li>daemonsets (aka &#39;ds&#39;)  </li>
<li>deployments (aka &#39;deploy&#39;)  </li>
<li>endpoints (aka &#39;ep&#39;)  </li>
<li>events (aka &#39;ev&#39;)  </li>
<li>horizontalpodautoscalers (aka &#39;hpa&#39;)  </li>
<li>ingresses (aka &#39;ing&#39;)  </li>
<li>jobs  </li>
<li>limitranges (aka &#39;limits&#39;)  </li>
<li>namespaces (aka &#39;ns&#39;)  </li>
<li>networkpolicies (aka &#39;netpol&#39;)  </li>
<li>nodes (aka &#39;no&#39;)  </li>
<li>persistentvolumeclaims (aka &#39;pvc&#39;)  </li>
<li>persistentvolumes (aka &#39;pv&#39;)  </li>
<li>poddisruptionbudgets (aka &#39;pdb&#39;)  </li>
<li>podpreset  </li>
<li>pods (aka &#39;po&#39;)  </li>
<li>podsecuritypolicies (aka &#39;psp&#39;)  </li>
<li>podtemplates  </li>
<li>replicasets (aka &#39;rs&#39;)  </li>
<li>replicationcontrollers (aka &#39;rc&#39;)  </li>
<li>resourcequotas (aka &#39;quota&#39;)  </li>
<li>rolebindings  </li>
<li>roles  </li>
<li>secrets  </li>
<li>serviceaccounts (aka &#39;sa&#39;)  </li>
<li>services (aka &#39;svc&#39;)  </li>
<li>statefulsets (aka &#39;sts&#39;)  </li>
<li>storageclasses (aka &#39;sc&#39;)</li>
</ul>
<h3 id="usage">Usage</h3>
<p><code>$ explain RESOURCE</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>api-version</td>
<td></td>
<td></td>
<td>Get different explanations for particular API version </td>
</tr>
<tr>
<td>include-extended-apis</td>
<td></td>
<td>true</td>
<td>If true, include definitions of new APIs via calls to the API server. [default true] </td>
</tr>
<tr>
<td>recursive</td>
<td></td>
<td>false</td>
<td>Print the fields of fields (Currently only 1 level deep) </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="options">options</h1>
<blockquote class="code-block example">
<p> Print flags inherited by all commands</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell"><span class="hljs-attribute">kubectl options</span>
</code></pre>
<p>Print the list of flags inherited by all commands</p>
<h3 id="usage">Usage</h3>
<p><code>$ options</code></p>
<hr>
<h1 id="version">version</h1>
<blockquote class="code-block example">
<p> Print the client and server versions for the current context</p>
</blockquote>
<pre class="code-block example"><code class="lang-shell">kubectl <span class="hljs-built_in">version</span>
</code></pre>
<p>Print the client and server version information for the current context</p>
<h3 id="usage">Usage</h3>
<p><code>$ version</code></p>
<h3 id="flags">Flags</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Shorthand</th>
<th>Default</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>client</td>
<td>c</td>
<td>false</td>
<td>Client version only (no server required). </td>
</tr>
<tr>
<td>output</td>
<td>o</td>
<td></td>
<td>One of &#39;yaml&#39; or &#39;json&#39;. </td>
</tr>
<tr>
<td>short</td>
<td></td>
<td>false</td>
<td>Print just the version number. </td>
</tr>
</tbody>
</table>
<hr>
<h1 id="plugin">plugin</h1>
<p>Runs a command-line plugin. </p>
<p>Plugins are subcommands that are not part of the major command-line distribution and can even be provided by third-parties. Please refer to the documentation and examples for more information about how to install and write your own plugins.</p>
<h3 id="usage">Usage</h3>
<p><code>$ plugin NAME</code></p>
<h1 id="-strong-deprecated-commands-strong-"><strong>DEPRECATED COMMANDS</strong></h1>
</div>
</div>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/jquery.scrollto/jquery.scrollTo.min.js"></script>
<script src="navData.js"></script>
<script src="scroll.js"></script>
<!--<script src="actions.js"></script>-->
<script src="tabvisibility.js"></script>
</body>
</html>